You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
923 lines
41 KiB
923 lines
41 KiB
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEditor;
|
||
|
using UnityEngine.AI;
|
||
|
public class SceneTool
|
||
|
{
|
||
|
// Use this for initialization
|
||
|
//[MenuItem("SceneTool/ShiNeiFloorRename")]
|
||
|
////设置每一层的室内结构父对象的名称,方法:选中每层室内父对象后设置
|
||
|
//public static void ShiNeiFloorRename()
|
||
|
//{
|
||
|
// bool containBuildNum = true;//生成名字是否包含楼号
|
||
|
// Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered);
|
||
|
// for (int i = 0; i < obj.Length; i++)
|
||
|
// {
|
||
|
// if (obj[i].GetComponent<FloorMessage>())
|
||
|
// {
|
||
|
// var buildNum = obj[i].GetComponent<FloorMessage>().buildNum;
|
||
|
// var floorNum = obj[i].GetComponent<FloorMessage>().floorNum;
|
||
|
// var interlayerNum = obj[i].GetComponent<FloorMessage>().interlayerNum;
|
||
|
// string name = "nei" + floorNum;
|
||
|
// if (containBuildNum)
|
||
|
// {
|
||
|
// name = buildNum + name;
|
||
|
// }
|
||
|
// if (interlayerNum != 0)
|
||
|
// {
|
||
|
// name = name + "*" + interlayerNum;
|
||
|
// }
|
||
|
// obj[i].name = name;
|
||
|
// obj[i].tag = "nei";
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
//[MenuItem("SceneTool/ShiWaiFloorRename")]
|
||
|
////设置每一层的室外结构父对象的名称,方法:选中每层室外父对象后设置
|
||
|
//public static void ShiWaiFloorRename()
|
||
|
//{
|
||
|
// bool containBuildNum = true;//生成名字是否包含楼号
|
||
|
// Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered);
|
||
|
// for (int i = 0; i < obj.Length; i++)
|
||
|
// {
|
||
|
// if (obj[i].GetComponent<FloorMessage>())
|
||
|
// {
|
||
|
// var buildNum = obj[i].GetComponent<FloorMessage>().buildNum;
|
||
|
// var floorNum = obj[i].GetComponent<FloorMessage>().floorNum;
|
||
|
// var interlayerNum = obj[i].GetComponent<FloorMessage>().interlayerNum;
|
||
|
// string name = "wai" + floorNum;
|
||
|
// if (containBuildNum)
|
||
|
// {
|
||
|
// name = buildNum + name;
|
||
|
// }
|
||
|
// if (interlayerNum != 0)
|
||
|
// {
|
||
|
// name = name + "*" + interlayerNum;
|
||
|
// }
|
||
|
// obj[i].name = name;
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
//[MenuItem("SceneTool/SetShiNeiFloor")]
|
||
|
////设置室内寻路,地面、楼梯、墙设置Layer加MeshCollider,墙加NavMeshModifier,地面、楼梯加静态Id脚本
|
||
|
////方法:选中每层室内父对象后设置
|
||
|
//public static void SetShiNeiFloor()
|
||
|
//{
|
||
|
// int[] NUM = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
|
||
|
// Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered);
|
||
|
// for (int i = 0; i < obj.Length; i++)
|
||
|
// {
|
||
|
// if (obj[i].GetComponent<FloorMessage>())
|
||
|
// {
|
||
|
// var buildNum = obj[i].GetComponent<FloorMessage>().buildNum;
|
||
|
// var floorNum = obj[i].GetComponent<FloorMessage>().floorNum;
|
||
|
// var interlayerNum = obj[i].GetComponent<FloorMessage>().interlayerNum;
|
||
|
// string layerName = "";
|
||
|
// if (floorNum < 0)
|
||
|
// {
|
||
|
// layerName = buildNum + "-10--1";
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// for (int k = 0; k < NUM.Length; k++)
|
||
|
// {
|
||
|
// if (floorNum > NUM[k] && floorNum <= NUM[k + 1])
|
||
|
// {
|
||
|
// var begin = NUM[k] + 1;
|
||
|
// var end = NUM[k + 1];
|
||
|
// layerName = buildNum + begin + "-" + end;
|
||
|
// break;
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
// var childObj = obj[i].GetComponentsInChildren<MeshRenderer>();
|
||
|
// for (int j = 0; j < childObj.Length; j++)
|
||
|
// {
|
||
|
// if (childObj[j].gameObject.name.ToUpper().Contains("LT") || childObj[j].gameObject.name.ToUpper().Contains("LOUTI"))
|
||
|
// {
|
||
|
// childObj[j].gameObject.layer = LayerMask.NameToLayer(layerName);
|
||
|
// if (!childObj[j].gameObject.GetComponent<MeshCollider>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<MeshCollider>();
|
||
|
// }
|
||
|
// if (!childObj[j].gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
// }
|
||
|
// var objInfo = childObj[j].gameObject.GetComponent<CloneGameObjInfo>();
|
||
|
// objInfo.gameObjType = CloneObjType.staticGameObject;
|
||
|
// objInfo.buildNum = buildNum;
|
||
|
// objInfo.floorNum = floorNum;
|
||
|
// objInfo.interlayerNum = interlayerNum;
|
||
|
|
||
|
// if (!childObj[j].gameObject.GetComponent<CreateStaticObjID>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
// }
|
||
|
// if (!childObj[j].gameObject.GetComponent<PathFindingClick>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<PathFindingClick>();
|
||
|
// }
|
||
|
// }
|
||
|
// if (childObj[j].gameObject.name.ToUpper().Contains("FLOOR"))
|
||
|
// {
|
||
|
// childObj[j].gameObject.layer = LayerMask.NameToLayer(layerName);
|
||
|
// if (!childObj[j].gameObject.GetComponent<MeshCollider>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<MeshCollider>();
|
||
|
// }
|
||
|
// if (!childObj[j].gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
// }
|
||
|
// var objInfo = childObj[j].gameObject.GetComponent<CloneGameObjInfo>();
|
||
|
// objInfo.gameObjType = CloneObjType.staticGameObject;
|
||
|
// objInfo.buildNum = buildNum;
|
||
|
// objInfo.floorNum = floorNum;
|
||
|
// objInfo.interlayerNum = interlayerNum;
|
||
|
|
||
|
// if (!childObj[j].gameObject.GetComponent<CreateStaticObjID>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
// }
|
||
|
// if (!childObj[j].gameObject.GetComponent<PathFindingClick>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<PathFindingClick>();
|
||
|
// }
|
||
|
// }
|
||
|
// if (childObj[j].gameObject.name.ToUpper().Contains("WALL"))
|
||
|
// {
|
||
|
// childObj[j].gameObject.layer = LayerMask.NameToLayer(layerName);
|
||
|
// if (!childObj[j].gameObject.GetComponent<MeshCollider>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<MeshCollider>();
|
||
|
// }
|
||
|
// if (!childObj[j].gameObject.GetComponent<NavMeshModifier>())
|
||
|
// {
|
||
|
// childObj[j].gameObject.AddComponent<NavMeshModifier>();
|
||
|
// }
|
||
|
// NavMeshModifier modifier = childObj[j].gameObject.GetComponent<NavMeshModifier>();
|
||
|
// modifier.overrideArea = true;
|
||
|
// modifier.area = NavMesh.GetAreaFromName("Not Walkable");
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
//[MenuItem("SceneTool/SetShiWaiFloor")]
|
||
|
////室外地面添加静态Id脚本,加MeshCollider,方法:选中整个场景后设置
|
||
|
//public static void SetShiWaiFloor()
|
||
|
//{
|
||
|
// Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
|
||
|
// for (int i = 0; i < obj.Length; i++)
|
||
|
// {
|
||
|
// if (obj[i].gameObject.layer == LayerMask.NameToLayer("Road"))
|
||
|
// {
|
||
|
// if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
// }
|
||
|
// var objInfo = obj[i].gameObject.GetComponent<CloneGameObjInfo>();
|
||
|
// objInfo.gameObjType = CloneObjType.staticGameObject;
|
||
|
|
||
|
// if (!obj[i].GetComponent<CreateStaticObjID>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<MeshCollider>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<MeshCollider>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<PathFindingClick>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<PathFindingClick>();
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
//[MenuItem("SceneTool/SetXHS")]
|
||
|
////给消火栓添加静态Id脚本,加MeshCollider,加水源的标记脚本,方法:选中消火栓后设置
|
||
|
//public static void SetXHS()
|
||
|
//{
|
||
|
// Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered);
|
||
|
// for (int i = 0; i < obj.Length; i++)
|
||
|
// {
|
||
|
// if (!obj[i].gameObject.GetComponent<MeshCollider>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<MeshCollider>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
// }
|
||
|
// var objInfo = obj[i].gameObject.GetComponent<CloneGameObjInfo>();
|
||
|
// objInfo.gameObjType = CloneObjType.staticGameObject;
|
||
|
// Transform pTrans = TransformHelper.FindParentByTag(obj[i], "nei");
|
||
|
// if (pTrans != null)
|
||
|
// {
|
||
|
// FloorMessage floorMsg = pTrans.GetComponent<FloorMessage>();
|
||
|
// objInfo.buildNum = floorMsg.buildNum;
|
||
|
// objInfo.floorNum = floorMsg.floorNum;
|
||
|
// objInfo.interlayerNum = floorMsg.interlayerNum;
|
||
|
// }
|
||
|
|
||
|
// if (!obj[i].gameObject.GetComponent<CreateStaticObjID>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<WaterSource>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<WaterSource>();
|
||
|
// }
|
||
|
// var waterSource = obj[i].gameObject.GetComponent<WaterSource>();
|
||
|
// waterSource.water = true;
|
||
|
// waterSource.foam = false;
|
||
|
// }
|
||
|
//}
|
||
|
//[MenuItem("SceneTool/SetJHQ")]
|
||
|
////给水泵接合器添加静态Id脚本,加MeshCollider,方法:选中接合器后设置
|
||
|
//public static void SetJHQ()
|
||
|
//{
|
||
|
// Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered);
|
||
|
// for (int i = 0; i < obj.Length; i++)
|
||
|
// {
|
||
|
// if (!obj[i].gameObject.GetComponent<MeshCollider>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<MeshCollider>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
// }
|
||
|
// var objInfo = obj[i].gameObject.GetComponent<CloneGameObjInfo>();
|
||
|
// objInfo.gameObjType = CloneObjType.staticGameObject;
|
||
|
// Transform pTrans = TransformHelper.FindParentByTag(obj[i], "nei");
|
||
|
// if (pTrans != null)
|
||
|
// {
|
||
|
// FloorMessage floorMsg = pTrans.GetComponent<FloorMessage>();
|
||
|
// objInfo.buildNum = floorMsg.buildNum;
|
||
|
// objInfo.floorNum = floorMsg.floorNum;
|
||
|
// objInfo.interlayerNum = floorMsg.interlayerNum;
|
||
|
// }
|
||
|
|
||
|
// if (!obj[i].gameObject.GetComponent<CreateStaticObjID>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
//[MenuItem("SceneTool/CreateFloorTarget")]
|
||
|
////在楼层中创建切层的相机跟随目标位置
|
||
|
//public static void CreateFloorTarget()
|
||
|
//{
|
||
|
// Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered);
|
||
|
// for (int i = 0; i < obj.Length; i++)
|
||
|
// {
|
||
|
// if (obj[i].GetComponent<FloorMessage>())
|
||
|
// {
|
||
|
// var buildNum = obj[i].GetComponent<FloorMessage>().buildNum;
|
||
|
// var floorNum = obj[i].GetComponent<FloorMessage>().floorNum;
|
||
|
// var interlayerNum = obj[i].GetComponent<FloorMessage>().interlayerNum;
|
||
|
// var target = obj[i].Find("TargetPosition");
|
||
|
// if (!target)
|
||
|
// {
|
||
|
// var targetObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||
|
// targetObj.name = "TargetPosition";
|
||
|
// targetObj.transform.parent = obj[i];
|
||
|
// targetObj.GetComponent<MeshRenderer>().enabled = false;
|
||
|
// targetObj.GetComponent<BoxCollider>().enabled = false;
|
||
|
// //对象名称
|
||
|
// var childObj = obj[i].GetComponentsInChildren<MeshRenderer>();
|
||
|
// for (int j = 0; j < childObj.Length; j++)
|
||
|
// {
|
||
|
// if (childObj[j].gameObject.name.ToUpper().Contains("FLOOR"))
|
||
|
// {
|
||
|
// targetObj.transform.position = childObj[j].gameObject.transform.position;
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
[MenuItem("SceneTool/CleanupMissingScripts")]
|
||
|
//清除场景中挂的丢失的脚本,完成后需重新打开项目
|
||
|
public static void CleanupMissingScripts()
|
||
|
{
|
||
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
|
||
|
for (int i = 0; i < obj.Length; i++)
|
||
|
{
|
||
|
var gameObject = obj[i].gameObject;
|
||
|
// We must use the GetComponents array to actually detect missing components
|
||
|
var components = gameObject.GetComponents<Component>();
|
||
|
|
||
|
// Create a serialized object so that we can edit the component list
|
||
|
var serializedObject = new SerializedObject(gameObject);
|
||
|
// Find the component list property
|
||
|
var prop = serializedObject.FindProperty("m_Component");
|
||
|
|
||
|
// Track how many components we've removed
|
||
|
int r = 0;
|
||
|
|
||
|
// Iterate over all components
|
||
|
for (int j = 0; j < components.Length; j++)
|
||
|
{
|
||
|
// Check if the ref is null
|
||
|
if (components[j] == null)
|
||
|
{
|
||
|
// If so, remove from the serialized component array
|
||
|
prop.DeleteArrayElementAtIndex(j - r);
|
||
|
// Increment removed count
|
||
|
r++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Apply our changes to the game object
|
||
|
serializedObject.ApplyModifiedProperties();
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("SceneTool/ChangeBuildName")]
|
||
|
static void ChangeBuildName()
|
||
|
{
|
||
|
//Transform zhuti = GameObject.Find("Scene").transform.Find("ZhuTi/A0ZhuTi");
|
||
|
//Transform shinei= GameObject.Find("Scene").transform.Find("ShiNei/A0ShiNei");
|
||
|
Transform zhuti = GameObject.Find("Scene").transform.Find("ZhuTi");
|
||
|
Transform shinei= GameObject.Find("Scene").transform.Find("ShiNei");
|
||
|
|
||
|
for (int i = 0; i < zhuti.childCount; i++)
|
||
|
{
|
||
|
change(zhuti.GetChild(i), 1);
|
||
|
}
|
||
|
for (int i = 0; i < shinei.childCount; i++)
|
||
|
{
|
||
|
change(shinei.GetChild(i), 1);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
static void change(Transform target, int index)
|
||
|
{
|
||
|
string build = target.name.Substring(0, index);
|
||
|
string neiwai = target.name.Contains("ShiNei") ? "nei" : "wai";
|
||
|
if (target.childCount < 1)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
for (int i = 0; i < target.childCount; i++)
|
||
|
{
|
||
|
|
||
|
//if (!target.GetChild(i).name.Contains("nei")||
|
||
|
// !target.GetChild(i).name.Contains("wai"))
|
||
|
//{
|
||
|
// return;
|
||
|
//}
|
||
|
target.GetChild(i).name = build + target.GetChild(i).name;
|
||
|
if (!target.GetChild(i).GetComponent<FloorMessage>())
|
||
|
{
|
||
|
target.GetChild(i).gameObject.AddComponent<FloorMessage>();
|
||
|
}
|
||
|
int floor;
|
||
|
if (!target.GetChild(i).name.Contains("M"))
|
||
|
{
|
||
|
int indexI = target.GetChild(i).name.IndexOf("i");
|
||
|
|
||
|
floor = int.Parse(target.GetChild(i).name.Substring(indexI + 1));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (target.GetChild(i).name.StartsWith("M") && !target.GetChild(i).name.EndsWith("M"))
|
||
|
{
|
||
|
int indexJ = target.GetChild(i).name.IndexOf("i");
|
||
|
|
||
|
floor = int.Parse(target.GetChild(i).name.Substring(indexJ + 1));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
int indexM = target.GetChild(i).name.IndexOf("M");
|
||
|
int indexI = target.GetChild(i).name.IndexOf("i");
|
||
|
Debug.Log(target.GetChild(i).name.Substring(indexI+1, indexM-indexI-1));
|
||
|
|
||
|
floor = int.Parse(target.GetChild(i).name.Substring(indexI + 1, indexM - indexI - 1));
|
||
|
}
|
||
|
}
|
||
|
//floor = int.Parse(target.GetChild(i).name.Substring(target.GetChild(i).name.IndexOf(neiwai)));
|
||
|
FloorMessage mess = target.GetChild(i).GetComponent<FloorMessage>();
|
||
|
mess.buildNum = build;
|
||
|
mess.floorNum = floor;
|
||
|
mess.interlayerNum = target.GetChild(i).name.Contains("M") ? 1 : 0;
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("SceneTool/SetGameObjType")]
|
||
|
static void SetGameObjType()
|
||
|
{
|
||
|
Transform scenc = GameObject.Find("SceneAll").transform;
|
||
|
CloneGameObjInfo[] infos = scenc.GetComponentsInChildren<CloneGameObjInfo>(true);
|
||
|
for (int i = 0; i < infos.Length; i++)
|
||
|
{
|
||
|
if (!infos[i].GetComponent<CreateStaticObjID>())
|
||
|
{
|
||
|
infos[i].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
}
|
||
|
if(!infos[i].gameObject.GetComponent<WaterSupplier>())
|
||
|
{
|
||
|
infos[i].gameObjType = CloneObjType.StaticGameObject;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("SceneTool/SetXHS")]
|
||
|
static void SetSetXHS()
|
||
|
{
|
||
|
Transform Scene = GameObject.Find("SceneAll").transform;//.Find("ShiNei/AShiNei");
|
||
|
WaterSupplier[] ws = Scene.GetComponentsInChildren<WaterSupplier>(true);
|
||
|
for (int i = 0; i < ws.Length; i++)
|
||
|
{
|
||
|
|
||
|
if (!ws[i].GetComponent<MeshCollider>())
|
||
|
{
|
||
|
ws[i].gameObject.AddComponent<MeshCollider>();
|
||
|
}
|
||
|
if (!ws[i].GetComponent<CloneableEnums>())
|
||
|
{
|
||
|
ws[i].WaterReceiverType = WaterType.water;
|
||
|
ws[i].gameObject.AddComponent<CloneableEnums>();
|
||
|
ws[i].GetComponent<CloneableEnums>().CloneableTypes.Add(CloneObjType.TwinkleLine);
|
||
|
ws[i].GetComponent<CloneableEnums>().CloneableTypes.Add(CloneObjType.WaterLine);
|
||
|
ws[i].GetComponent<BaseGameObjInfo>().gameObjType = CloneObjType.StaticGameObject;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
}
|
||
|
ws[i].GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.XHS;
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("SceneTool/AddFireNormalShiNei")]
|
||
|
static void AddFireNormal()
|
||
|
{
|
||
|
Transform Ashinei = GameObject.Find("Scene").transform.Find("ShiNei");
|
||
|
CloneableEnums[] enums = Ashinei.GetComponentsInChildren<CloneableEnums>(true);
|
||
|
for (int i = 0; i < enums.Length; i++)
|
||
|
{
|
||
|
if (enums[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType!=CloneObjType.XHS)
|
||
|
{
|
||
|
if (!enums[i].CloneableTypes.Contains(CloneObjType.FireNormal))
|
||
|
{
|
||
|
enums[i].CloneableTypes.Add(CloneObjType.FireNormal);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("SceneTool/SetFloorMessage")]
|
||
|
static void SetFloorMessage()
|
||
|
{
|
||
|
Transform shinei = GameObject.Find("Scene").transform.Find("ShiNei");
|
||
|
CloneGameObjInfo[] infos = shinei.GetComponentsInChildren<CloneGameObjInfo>();
|
||
|
for (int i = 0; i < infos.Length; i++)
|
||
|
{
|
||
|
if (infos[i].name.ToLower().Contains("floor"))
|
||
|
{
|
||
|
infos[i].buildNum = infos[i].GetComponentInParent<FloorMessage>().buildNum;
|
||
|
infos[i].floorNum = infos[i].GetComponentInParent<FloorMessage>().floorNum;
|
||
|
infos[i].interlayerNum= infos[i].GetComponentInParent<FloorMessage>().interlayerNum;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("SceneTool/AddFloorSprite")]
|
||
|
static void AddFloorSprite()
|
||
|
{
|
||
|
Transform shinei = GameObject.Find("Scene").transform.Find("ShiNei");
|
||
|
getFloor(shinei);
|
||
|
}
|
||
|
static Transform getFloor(Transform parent)
|
||
|
{
|
||
|
CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("ShiNei").GetComponent<CloneableEnums>();
|
||
|
Transform target = null;
|
||
|
for (int i = 0; i < parent.childCount; i++)
|
||
|
{
|
||
|
if (parent.GetChild(i).childCount > 0)
|
||
|
{
|
||
|
getFloor(parent.GetChild(i));
|
||
|
}
|
||
|
if (parent.GetChild(i).name.ToLower().Contains("floor"))
|
||
|
{
|
||
|
//Debug.Log(parent.GetChild(i).name);
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CloneableEnums>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CloneableEnums>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<MeshCollider>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<MeshCollider>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<PathFindingClick>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<PathFindingClick>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CreateStaticObjID>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CreateStaticObjID>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
}
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneableEnums>().CloneableTypes = ce.CloneableTypes;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject;
|
||
|
parent.GetChild(i).gameObject.layer = 30;
|
||
|
FloorMessage mess = parent.GetChild(i).gameObject.GetComponentInParent<FloorMessage>();
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().buildNum = mess.buildNum;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().floorNum = mess.floorNum;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = mess.interlayerNum;
|
||
|
}
|
||
|
else { }
|
||
|
}
|
||
|
return target;
|
||
|
}
|
||
|
|
||
|
[MenuItem("SceneTool/AddLTSprite")]
|
||
|
static void AddLTSprite()
|
||
|
{
|
||
|
Transform shinei = GameObject.Find("Scene").transform.Find("ShiNei");
|
||
|
getlt(shinei);
|
||
|
}
|
||
|
static Transform getlt(Transform parent)
|
||
|
{
|
||
|
CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("ShiNei").GetComponent<CloneableEnums>();
|
||
|
Transform target = null;
|
||
|
for (int i = 0; i < parent.childCount; i++)
|
||
|
{
|
||
|
if (parent.GetChild(i).childCount > 0)
|
||
|
{
|
||
|
getlt(parent.GetChild(i));
|
||
|
}
|
||
|
if (parent.GetChild(i).name.ToLower().Contains("lt") && parent.GetChild(i).GetComponent<MeshRenderer>())
|
||
|
{
|
||
|
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CloneableEnums>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CloneableEnums>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<MeshCollider>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<MeshCollider>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<PathFindingClick>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<PathFindingClick>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CreateStaticObjID>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CreateStaticObjID>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
}
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneableEnums>().CloneableTypes = ce.CloneableTypes;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject;
|
||
|
parent.GetChild(i).gameObject.layer = 30;
|
||
|
FloorMessage mess = parent.GetChild(i).gameObject.GetComponentInParent<FloorMessage>();
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().buildNum = mess.buildNum;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().floorNum = mess.floorNum;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = mess.interlayerNum;
|
||
|
}
|
||
|
else { }
|
||
|
}
|
||
|
return target;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
[MenuItem("SceneTool/AddFTSprite")]
|
||
|
static void AddFTSprite()
|
||
|
{
|
||
|
Transform shinei = GameObject.Find("Scene").transform.Find("ShiNei");
|
||
|
getft(shinei);
|
||
|
}
|
||
|
static Transform getft(Transform parent)
|
||
|
{
|
||
|
CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("ShiNei").GetComponent<CloneableEnums>();
|
||
|
Transform target = null;
|
||
|
for (int i = 0; i < parent.childCount; i++)
|
||
|
{
|
||
|
if (parent.GetChild(i).childCount > 0)
|
||
|
{
|
||
|
getft(parent.GetChild(i));
|
||
|
}
|
||
|
if ((parent.GetChild(i).name.ToLower().Contains("futi")|| parent.GetChild(i).name.ToLower().Contains("ft"))
|
||
|
&& parent.GetChild(i).GetComponent<MeshRenderer>())
|
||
|
{
|
||
|
// Debug.Log(parent.GetChild(i).name);
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CloneableEnums>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CloneableEnums>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<MeshCollider>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<MeshCollider>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<PathFindingClick>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<PathFindingClick>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CreateStaticObjID>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CreateStaticObjID>();
|
||
|
}
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
}
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneableEnums>().CloneableTypes = ce.CloneableTypes;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject;
|
||
|
parent.GetChild(i).gameObject.layer = 30;
|
||
|
FloorMessage mess = parent.GetChild(i).gameObject.GetComponentInParent<FloorMessage>();
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().buildNum = mess.buildNum;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().floorNum = mess.floorNum;
|
||
|
parent.GetChild(i).gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = mess.interlayerNum;
|
||
|
}
|
||
|
else { }
|
||
|
}
|
||
|
return target;
|
||
|
}
|
||
|
|
||
|
|
||
|
[MenuItem("SceneTool/SetWall")]
|
||
|
static void SetWallSprite()
|
||
|
{
|
||
|
Transform shinei = GameObject.Find("Scene").transform.Find("ShiNei");
|
||
|
setwall(shinei);
|
||
|
}
|
||
|
static Transform setwall(Transform parent)
|
||
|
{
|
||
|
CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("ShiNei").GetComponent<CloneableEnums>();
|
||
|
Transform target = null;
|
||
|
for (int i = 0; i < parent.childCount; i++)
|
||
|
{
|
||
|
if (parent.GetChild(i).childCount > 0)
|
||
|
{
|
||
|
setwall(parent.GetChild(i));
|
||
|
}
|
||
|
if (parent.GetChild(i).name.ToLower().Contains("wall") && parent.GetChild(i).GetComponent<MeshRenderer>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.layer = 29;
|
||
|
}
|
||
|
}
|
||
|
return target;
|
||
|
}
|
||
|
|
||
|
|
||
|
[MenuItem("SceneTool/SetShiNeiXHS")]
|
||
|
static void SetShiNeiXHS()
|
||
|
{
|
||
|
Transform shinei = GameObject.Find("Scene").transform.Find("ShiNei");
|
||
|
setxhs(shinei);
|
||
|
}
|
||
|
static Transform setxhs(Transform parent)
|
||
|
{
|
||
|
CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("xhs").GetComponent<CloneableEnums>();
|
||
|
Transform target = null;
|
||
|
for (int i = 0; i < parent.childCount; i++)
|
||
|
{
|
||
|
if (parent.GetChild(i).childCount > 0)
|
||
|
{
|
||
|
setxhs(parent.GetChild(i));
|
||
|
}
|
||
|
if (parent.GetChild(i).name.ToLower().Contains("xhs") && parent.GetChild(i).GetComponent<MeshRenderer>())
|
||
|
{
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<WaterSupplier>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<WaterSupplier>();
|
||
|
}
|
||
|
|
||
|
parent.GetChild(i).GetComponent<WaterSupplier>().WaterReceiverType = WaterType.water;
|
||
|
if (!parent.GetChild(i).gameObject.GetComponent<CloneableEnums>())
|
||
|
{
|
||
|
parent.GetChild(i).gameObject.AddComponent<CloneableEnums>();
|
||
|
|
||
|
}
|
||
|
parent.GetChild(i).GetComponent<CloneableEnums>().CloneableTypes.Clear();
|
||
|
parent.GetChild(i).GetComponent<CloneableEnums>().CloneableTypes.Add(CloneObjType.TwinkleLine);
|
||
|
parent.GetChild(i).GetComponent<CloneableEnums>().CloneableTypes.Add(CloneObjType.WaterLine);
|
||
|
parent.GetChild(i).GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.XHS;
|
||
|
}
|
||
|
}
|
||
|
return target;
|
||
|
}
|
||
|
[MenuItem("SceneTool/SetOilRodeCarCloneEnum")]
|
||
|
public static void SetOilRodeCarCloneEnum()
|
||
|
{
|
||
|
CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("OilCarRode").GetComponent<CloneableEnums>();
|
||
|
CloneableEnums[] allenums = GameObject.Find("SceneAll").GetComponentsInChildren<CloneableEnums>(true);
|
||
|
for (int i = 0; i < allenums.Length; i++)
|
||
|
{
|
||
|
if (!allenums[i].GetComponent<NavMeshModifier>())
|
||
|
{
|
||
|
if (!allenums[i].GetComponent<OilMask>())
|
||
|
{
|
||
|
if (!allenums[i].GetComponent<WaterSupplier>())
|
||
|
{
|
||
|
allenums[i].GetComponent<CloneableEnums>().CloneableTypes = ce.CloneableTypes;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("SceneTool/SetOilRodeManCloneEnum")]
|
||
|
public static void SetOilRodeManCloneEnum()
|
||
|
{
|
||
|
CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("OilManRode").GetComponent<CloneableEnums>();
|
||
|
CloneableEnums[] allenums = GameObject.Find("SceneAll").GetComponentsInChildren<CloneableEnums>(true);
|
||
|
for (int i = 0; i < allenums.Length; i++)
|
||
|
{
|
||
|
if (allenums[i].GetComponent<NavMeshModifier>())
|
||
|
{
|
||
|
if (!allenums[i].GetComponent<OilMask>())
|
||
|
{
|
||
|
if (!allenums[i].GetComponent<WaterSupplier>())
|
||
|
{
|
||
|
allenums[i].GetComponent<CloneableEnums>().CloneableTypes = ce.CloneableTypes;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("SceneTool/SetOilWallCloneEnum")]
|
||
|
public static void SetOilWallCloneEnum()
|
||
|
{
|
||
|
CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("OilWall").GetComponent<CloneableEnums>();
|
||
|
CloneableEnums[] allenums = GameObject.Find("SceneAll").GetComponentsInChildren<CloneableEnums>(true);
|
||
|
for (int i = 0; i < allenums.Length; i++)
|
||
|
{
|
||
|
if (allenums[i].GetComponent<OilMask>())
|
||
|
{
|
||
|
if (!allenums[i].GetComponent<PathFindingClick>())
|
||
|
{
|
||
|
allenums[i].GetComponent<CloneableEnums>().CloneableTypes = ce.CloneableTypes;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
//[MenuItem("SceneTool/RemoveNone")]
|
||
|
//public static void ReMoveNone()
|
||
|
//{
|
||
|
// CloneableEnums ce = GameObject.Find("CloneEnums").transform.Find("OilManRode").GetComponent<CloneableEnums>();
|
||
|
// for (int i = 0; i < ce.CloneableTypes.Count; i++)
|
||
|
// {
|
||
|
// if (ce.CloneableTypes[i]==CloneObjType.None)
|
||
|
// {
|
||
|
// ce.CloneableTypes.Remove(ce.CloneableTypes[i]);
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
[MenuItem("CloneTypeEditor/AddNewTrucksToolsCloneable")]
|
||
|
static void AddNewTrucksToolsCloneable()
|
||
|
{
|
||
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
|
||
|
for (int i = 0; i < obj.Length; i++)
|
||
|
{
|
||
|
var cloneableEnums = obj[i].GetComponent<CloneableEnums>();
|
||
|
if (cloneableEnums != null)
|
||
|
{
|
||
|
var cloneableTypes = cloneableEnums.CloneableTypes;
|
||
|
if (cloneableTypes != null && cloneableTypes.Contains(CloneObjType.WaterTanker))
|
||
|
{
|
||
|
AddType(cloneableTypes, CloneObjType.RemoteWaterSupplyTruck);
|
||
|
AddType(cloneableTypes, CloneObjType.DecontaminationTruck);
|
||
|
AddType(cloneableTypes, CloneObjType.LiquidSupplyTruck);
|
||
|
AddType(cloneableTypes, CloneObjType.FoodSecurityTruck);
|
||
|
AddType(cloneableTypes, CloneObjType.EquipmentTransportTruck);
|
||
|
AddType(cloneableTypes, CloneObjType.EquipmentRepairTruck);
|
||
|
AddType(cloneableTypes, CloneObjType.MedicalSupportTruck);
|
||
|
AddType(cloneableTypes, CloneObjType.DryPowderFireTruck);
|
||
|
AddType(cloneableTypes, CloneObjType.TrafficPoliceCar);
|
||
|
AddType(cloneableTypes, CloneObjType.EnvironmentalCar);
|
||
|
AddType(cloneableTypes, CloneObjType.WeatherBureauCar);
|
||
|
AddType(cloneableTypes, CloneObjType.PowerSupplyCar);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
private static void AddType(List<CloneObjType> cloneableTypes, CloneObjType type)
|
||
|
{
|
||
|
if (!cloneableTypes.Contains(type))
|
||
|
{
|
||
|
cloneableTypes.Add(type);
|
||
|
}
|
||
|
}
|
||
|
[MenuItem("CloneTypeEditor/SetCloneNei")]
|
||
|
//给罐区地面设置克隆类型,方法:选中整个场景后设置
|
||
|
public static void SetCloneNei()
|
||
|
{
|
||
|
List<CloneObjType> CloneableTypes = new List<CloneObjType>();
|
||
|
for (int i = (int)CloneObjType.WarningLine; i <= (int)CloneObjType.FireMan; i++)
|
||
|
{
|
||
|
if ((CloneObjType)i != CloneObjType.Splash &&
|
||
|
(CloneObjType)i != CloneObjType.Boilover)//&&
|
||
|
//(CloneObjType)i != CloneObjType.FireInside&&
|
||
|
//(CloneObjType)i != CloneObjType.SmokeInside)
|
||
|
CloneableTypes.Add((CloneObjType)i);
|
||
|
}
|
||
|
List<CloneObjType> CloneableTypesXHS = new List<CloneObjType>();
|
||
|
CloneableTypesXHS.Add(CloneObjType.WaterLine);
|
||
|
CloneableTypesXHS.Add(CloneObjType.TwinkleLine);
|
||
|
|
||
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
|
||
|
for (int i = 0; i < obj.Length; i++)
|
||
|
{
|
||
|
if (obj[i].gameObject.name.ToUpper().Contains("-FLOOR") || obj[i].gameObject.name.ToUpper().Contains("_FLOOR"))
|
||
|
{
|
||
|
Debug.Log(obj[i].gameObject.name);
|
||
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>())
|
||
|
{
|
||
|
obj[i].gameObject.AddComponent<CloneableEnums>();
|
||
|
}
|
||
|
var cloneableEnums = obj[i].GetComponent<CloneableEnums>();
|
||
|
cloneableEnums.CloneableTypes = CloneableTypes;
|
||
|
if (!obj[i].gameObject.GetComponent<MeshCollider>())
|
||
|
{
|
||
|
obj[i].gameObject.AddComponent<MeshCollider>();
|
||
|
}
|
||
|
if (!obj[i].gameObject.GetComponent<PathFindingClick>())
|
||
|
{
|
||
|
obj[i].gameObject.AddComponent<PathFindingClick>();
|
||
|
}
|
||
|
if (!obj[i].gameObject.GetComponent<CreateStaticObjID>())
|
||
|
{
|
||
|
obj[i].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
}
|
||
|
obj[i].gameObject.layer = LayerMask.NameToLayer("ShiNei");
|
||
|
CloneGameObjInfo info = obj[i].gameObject.GetComponent<CloneGameObjInfo>();
|
||
|
info.buildNum = obj[i].parent.GetComponent<FloorMessage>().buildNum;
|
||
|
info.floorNum = obj[i].parent.GetComponent<FloorMessage>().floorNum;
|
||
|
info.interlayerNum = obj[i].parent.GetComponent<FloorMessage>().interlayerNum;
|
||
|
}
|
||
|
//if (obj[i].gameObject.name.ToUpper().Contains("LT") && obj[i].childCount == 0
|
||
|
// && obj[i].gameObject.name.ToUpper().IndexOf("LT") == 0)
|
||
|
//{
|
||
|
// Debug.Log(obj[i].gameObject.name);
|
||
|
// if (!obj[i].gameObject.GetComponent<MeshCollider>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<MeshCollider>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<PathFindingClick>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<PathFindingClick>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<CreateStaticObjID>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
// }
|
||
|
// CloneGameObjInfo info = obj[i].gameObject.GetComponent<CloneGameObjInfo>();
|
||
|
// info.buildNum = obj[i].parent.parent.GetComponent<FloorMessage>().buildNum;
|
||
|
// info.floorNum = obj[i].parent.parent.GetComponent<FloorMessage>().floorNum;
|
||
|
// info.interlayerNum = obj[i].parent.parent.GetComponent<FloorMessage>().interlayerNum;
|
||
|
// obj[i].gameObject.layer = LayerMask.NameToLayer("ShiNei");
|
||
|
//}
|
||
|
//if (obj[i].gameObject.name.ToUpper().Contains("XHS") && obj[i].childCount == 0)
|
||
|
//{
|
||
|
// Debug.Log(obj[i].gameObject.name);
|
||
|
// if (!obj[i].gameObject.GetComponent<MeshCollider>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<MeshCollider>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<CreateStaticObjID>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CreateStaticObjID>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<CloneableEnums>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CloneableEnums>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<WaterSupplier>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<WaterSupplier>();
|
||
|
// }
|
||
|
// if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>())
|
||
|
// {
|
||
|
// obj[i].gameObject.AddComponent<CloneGameObjInfo>();
|
||
|
// }
|
||
|
// CloneGameObjInfo info = obj[i].gameObject.GetComponent<CloneGameObjInfo>();
|
||
|
// if (obj[i].parent.parent.GetComponent<FloorMessage>())
|
||
|
// {
|
||
|
// info.buildNum = obj[i].parent.parent.GetComponent<FloorMessage>().buildNum;
|
||
|
// info.floorNum = obj[i].parent.parent.GetComponent<FloorMessage>().floorNum;
|
||
|
// info.interlayerNum = obj[i].parent.parent.GetComponent<FloorMessage>().interlayerNum;
|
||
|
// }
|
||
|
// info.gameObjType = CloneObjType.XHS;
|
||
|
// obj[i].gameObject.GetComponent<WaterSupplier>().WaterReceiverType = WaterType.water;
|
||
|
// var cloneableEnums = obj[i].GetComponent<CloneableEnums>();
|
||
|
// cloneableEnums.CloneableTypes = CloneableTypesXHS;
|
||
|
//}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|