using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.AI;
public class SceneToolNew
{
///
/// 需要在楼层上手动挂载FloorMessage脚本
///
[MenuItem("SceneToolNew/SetFloorMessage")]
public static void SetfloorMessage()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
for (int i = 0; i < obj.Length; i++)
{
if (obj[i].GetComponent())
{
string name = obj[i].name;
obj[i].GetComponent().buildNum = name.Substring(0,1);
if (name.ToLower().Contains("m"))
{
obj[i].GetComponent().floorNum = int.Parse(name.Substring(5, name.Length - 5));
obj[i].GetComponent().interlayerNum = 1;
}
else
{
obj[i].GetComponent().floorNum = int.Parse(name.Substring(4, name.Length - 4));
obj[i].GetComponent().interlayerNum = 0;
}
}
}
}
[MenuItem("SceneToolNew/SetWallCanMove")]
public static void SetWallCanMove()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
for (int i = 0; i < obj.Length; i++)
{
if (obj[i].gameObject.layer == LayerMask.NameToLayer("Wall"))
{
if(!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
obj[i].gameObject.GetComponent().overrideArea = true;
obj[i].gameObject.GetComponent().area = 1;
}
}
}
[MenuItem("SceneToolNew/SetNavLayerShiWaiCarRoad")]
public static void SetNavLayerShiWaiCarRoad()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
for (int i = 0; i < obj.Length; i++)
{
if (obj[i].gameObject.layer == LayerMask.NameToLayer("CarRode"))
{
if (!obj[i].gameObject.GetComponent())
{
//Debug.Log(obj[i].name);
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
obj[i].gameObject.GetComponent().gameObjType=CloneObjType.StaticGameObject;
CloneableEnums enumParent = obj[i].gameObject.GetComponent();
Transform Template = GameObject.Find("CloneEnums").transform.Find("CarRoad");
var CloneableEnums = Template.GetComponent();
enumParent.CloneableTypes = CloneableEnums.CloneableTypes;
}
}
}
}
[MenuItem("SceneToolNew/SetNavLayerShiWaiSoldierRoad")]
public static void SetNavLayerShiWaiSoliderRoad()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
for (int i = 0; i < obj.Length; i++)
{
if (obj[i].gameObject.layer == LayerMask.NameToLayer("ManRode"))
{
if (!obj[i].gameObject.GetComponent())
{
//Debug.Log(obj[i].name);
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
obj[i].gameObject.GetComponent().gameObjType = CloneObjType.StaticGameObject;
CloneableEnums enumParent = obj[i].gameObject.GetComponent();
Transform Template = GameObject.Find("CloneEnums").transform.Find("ShiWaiSoldier");
var CloneableEnums = Template.GetComponent();
enumParent.CloneableTypes = CloneableEnums.CloneableTypes;
}
}
}
}
[MenuItem("SceneToolNew/SetShiNeiFloor")]
public static void SetShiNeiFloor()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
for (int i = 0; i < obj.Length; i++)
{
if (obj[i].gameObject.name.ToLower().Contains("floor")&&
obj[i].gameObject.GetComponent())
{
if (!obj[i].gameObject.GetComponent())
{
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
CloneableEnums enumParent = obj[i].gameObject.GetComponent();
Transform Template = GameObject.Find("CloneEnums").transform.Find("ShiNeiFloor");
var CloneableEnums = Template.GetComponent();
enumParent.CloneableTypes = CloneableEnums.CloneableTypes;
FloorMessage mess = obj[i].GetComponentInParent();
obj[i].gameObject.GetComponent().gameObjType = CloneObjType.StaticGameObject;
obj[i].gameObject.GetComponent().buildNum = mess.buildNum;
obj[i].gameObject.GetComponent().interlayerNum = mess.interlayerNum;
obj[i].gameObject.GetComponent().floorNum = mess.floorNum;
obj[i].gameObject.layer = LayerMask.NameToLayer("ManRode");
}
}
}
}
[MenuItem("SceneToolNew/SetShiNeiLT")]
public static void SetShiNeiLT()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
for (int i = 0; i < obj.Length; i++)
{
if (obj[i].gameObject.name.ToLower().Contains("lt") &&
obj[i].gameObject.GetComponent())
{
if (!obj[i].gameObject.GetComponent())
{
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
CloneableEnums enumParent = obj[i].gameObject.GetComponent();
Transform Template = GameObject.Find("CloneEnums").transform.Find("ShiNeiFloor");
var CloneableEnums = Template.GetComponent();
enumParent.CloneableTypes = CloneableEnums.CloneableTypes;
FloorMessage mess = obj[i].GetComponentInParent();
obj[i].gameObject.GetComponent().gameObjType = CloneObjType.StaticGameObject;
obj[i].gameObject.GetComponent().buildNum = mess.buildNum;
obj[i].gameObject.GetComponent().interlayerNum = mess.interlayerNum;
obj[i].gameObject.GetComponent().floorNum = mess.floorNum;
obj[i].gameObject.layer = LayerMask.NameToLayer("ManRode");
}
}
}
}
[MenuItem("SceneToolNew/SetShiNeiXHS")]
public static void SetShiNeiXHS()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
for (int i = 0; i < obj.Length; i++)
{
if ((obj[i].gameObject.name.ToLower().Contains("xhs")|| obj[i].gameObject.name.ToLower().Contains("snxh")) &&
obj[i].gameObject.GetComponent())
{
if (!obj[i].gameObject.GetComponent())
{
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
obj[i].gameObject.GetComponent().WaterReceiverType=WaterType.water;
}
CloneableEnums enumParent = obj[i].gameObject.GetComponent();
Transform Template = GameObject.Find("CloneEnums").transform.Find("xhs");
var CloneableEnums = Template.GetComponent();
enumParent.CloneableTypes = CloneableEnums.CloneableTypes;
FloorMessage mess = obj[i].GetComponentInParent();
obj[i].gameObject.GetComponent().gameObjType = CloneObjType.XHS;
obj[i].gameObject.GetComponent().buildNum = mess.buildNum;
obj[i].gameObject.GetComponent().interlayerNum = mess.interlayerNum;
obj[i].gameObject.GetComponent().floorNum = mess.floorNum;
}
}
}
}
[MenuItem("SceneToolNew/SetShiWaiZhutiSoldierRoad")]
public static void SetShiWaiZhutiSoldierRoad()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
for (int i = 0; i < obj.Length; i++)
{
if (obj[i].gameObject.layer == LayerMask.NameToLayer("ManRode"))
{
if (!obj[i].gameObject.GetComponent())
{
//Debug.Log(obj[i].name);
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
if (!obj[i].gameObject.GetComponent())
{
obj[i].gameObject.AddComponent();
}
CloneableEnums enumParent = obj[i].gameObject.GetComponent();
Transform Template = GameObject.Find("CloneEnums").transform.Find("ShiWaiSoldier");
var CloneableEnums = Template.GetComponent();
enumParent.CloneableTypes = CloneableEnums.CloneableTypes;
FloorMessage mess = obj[i].GetComponentInParent();
obj[i].gameObject.GetComponent().gameObjType = CloneObjType.StaticGameObject;
obj[i].gameObject.GetComponent().buildNum = mess.buildNum;
obj[i].gameObject.GetComponent().interlayerNum = mess.interlayerNum;
obj[i].gameObject.GetComponent().floorNum = mess.floorNum;
}
}
}
}
}