|
|
|
@ -73,186 +73,205 @@ public class SceneTool
|
|
|
|
|
for (int i = 0; i < parent.childCount; i++) |
|
|
|
|
{ |
|
|
|
|
if (parent.GetChild(i).name.ToLower().Contains("_floor") |
|
|
|
|
|| parent.GetChild(i).name.ToLower().Contains("-floor") |
|
|
|
|
|| parent.GetChild(i).name.ToLower().Contains("-floor") |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
return parent.GetChild(i); |
|
|
|
|
if (parent.GetChild(i).GetComponent<MeshRenderer>()) |
|
|
|
|
return parent.GetChild(i); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return parent; |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/Setshinei")]//添加寻路层(选中shinei对象设置,注:扶梯情况特殊没有包含) |
|
|
|
|
public static void SetShiNei() |
|
|
|
|
[MenuItem("SceneTool/SetNavLayerShiNeiFloor")]//添加寻路层(选中shinei对象设置,注:扶梯情况特殊没有包含) |
|
|
|
|
public static void SetNavLayerShiNeiFloor() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
if (obj[i].name.ToLower().Contains("_floor") ||//地面 |
|
|
|
|
obj[i].name.ToLower().Contains("_floor") || |
|
|
|
|
obj[i].name.ToLower().Contains("floor") || |
|
|
|
|
obj[i].name.ToLower().Contains("chewei") || |
|
|
|
|
obj[i].name.ToLower().Contains("-floor") && |
|
|
|
|
obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
if ((obj[i].name.ToLower().Contains("floor") ||//地面 |
|
|
|
|
obj[i].name.ToLower().Contains("lt") || |
|
|
|
|
obj[i].name.ToLower().Contains("chedao") || |
|
|
|
|
obj[i].name.ToLower().Contains("ft")) && !obj[i].name.ToLower().Contains("ltcs")) |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<PathFindable>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.ShiNeiMan; |
|
|
|
|
if (obj[i].GetComponentInParent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].GetComponentInParent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (obj[i].name.ToLower().Contains("wall") ||//墙面 |
|
|
|
|
obj[i].name.ToLower().Contains("zhuzi")) |
|
|
|
|
if (!obj[i].gameObject.GetComponent<PathFindable>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<NavMeshModifier>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<NavMeshModifier>(); |
|
|
|
|
} |
|
|
|
|
NavMeshModifier mod = obj[i].gameObject.GetComponent<NavMeshModifier>(); |
|
|
|
|
mod.overrideArea = true; |
|
|
|
|
mod.area = 1; |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
CloneableEnums enumParent = obj[i].gameObject.GetComponent<CloneableEnums>(); |
|
|
|
|
Transform Template = GameObject.Find("TheCarRoad").transform.Find("ShiNeiFloor"); |
|
|
|
|
var CloneableEnums = Template.GetComponent<CloneableEnums>(); |
|
|
|
|
enumParent.CloneableTypes = CloneableEnums.CloneableTypes; |
|
|
|
|
if (obj[i].parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
if (obj[i].parent.parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].parent.parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/SetshineiXHS")]//设置室内消火栓属性 |
|
|
|
|
public static void SetSNXHS() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].name.ToLower().Contains("xhs") && |
|
|
|
|
if (obj[i].name.ToLower().Contains("_wall") ||//墙面 |
|
|
|
|
obj[i].name.ToLower().Contains("_wall") || |
|
|
|
|
obj[i].name.ToLower().Contains("wall") || |
|
|
|
|
obj[i].name.ToLower().Contains("-wall") && |
|
|
|
|
obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
if (!obj[i].gameObject.GetComponent<BoxCollider>()) |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<NavMeshModifier>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<BoxCollider>(); |
|
|
|
|
obj[i].gameObject.AddComponent<NavMeshModifier>(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
NavMeshModifier mod = obj[i].gameObject.GetComponent<NavMeshModifier>(); |
|
|
|
|
mod.overrideArea = true; |
|
|
|
|
mod.area = 1; |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.IndoorFireHydrant; |
|
|
|
|
if (!obj[i].gameObject.GetComponent<InDoorHydrantMessage>()) |
|
|
|
|
} |
|
|
|
|
if (obj[i].name.ToLower().Contains("zhuzi") ||//柱子 |
|
|
|
|
obj[i].name.ToLower().Contains("_zhuzi") || |
|
|
|
|
obj[i].name.ToLower().Contains("-zhuzi") && |
|
|
|
|
obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
//Debug.Log(obj[i].name); |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<NavMeshModifier>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<InDoorHydrantMessage>(); |
|
|
|
|
obj[i].gameObject.AddComponent<NavMeshModifier>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<WaterSource>()) |
|
|
|
|
NavMeshModifier mod = obj[i].gameObject.GetComponent<NavMeshModifier>(); |
|
|
|
|
mod.overrideArea = true; |
|
|
|
|
mod.area = 1; |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<WaterSource>(); |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjID == 0) |
|
|
|
|
} |
|
|
|
|
if (obj[i].name.ToLower().Contains("lt") && |
|
|
|
|
obj[i].GetComponent<MeshRenderer>() && |
|
|
|
|
!obj[i].name.ToLower().Contains("lt_name") && |
|
|
|
|
!obj[i].name.ToLower().Contains("_ltcs"))//楼梯 |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
long staticGameObjId = (long)GUID.NewGuid(1, 1); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().SetGameObjID(staticGameObjId); |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<PathFindable>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
CloneableEnums enumParent = obj[i].gameObject.GetComponent<CloneableEnums>(); |
|
|
|
|
Transform Template = GameObject.Find("TheCarRoad").transform.Find("ShiNeiFloor"); |
|
|
|
|
var CloneableEnums = Template.GetComponent<CloneableEnums>(); |
|
|
|
|
enumParent.CloneableTypes = CloneableEnums.CloneableTypes; |
|
|
|
|
if (obj[i].parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
FloorMessage fmg = obj[i].parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.ShiNeiXHS; |
|
|
|
|
if (obj[i].GetComponentInParent<FloorMessage>()) |
|
|
|
|
if (obj[i].parent.parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].GetComponentInParent<FloorMessage>(); |
|
|
|
|
FloorMessage fmg = obj[i].parent.parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/DiXiaLouDing/CheNengZou")]//地面的楼顶(车能走),常见为地下建筑上的公路 |
|
|
|
|
public static void DiXiaLouDingCheNengZou() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
if (obj[i].name.ToLower().Contains("ft") && |
|
|
|
|
obj[i].GetComponent<MeshRenderer>() && |
|
|
|
|
!obj[i].name.ToLower().Contains("ft_name") && |
|
|
|
|
!obj[i].name.ToLower().Contains("bf"))//扶梯 |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("CarRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<PathFindable>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.ShiWaiCar; |
|
|
|
|
if (obj[i].GetComponentInParent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].GetComponentInParent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().SpecialTag = "楼顶"; |
|
|
|
|
} |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<PathFindable>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
CloneableEnums enumParent = obj[i].gameObject.GetComponent<CloneableEnums>(); |
|
|
|
|
Transform Template = GameObject.Find("TheCarRoad").transform.Find("ShiNeiFloor"); |
|
|
|
|
var CloneableEnums = Template.GetComponent<CloneableEnums>(); |
|
|
|
|
enumParent.CloneableTypes = CloneableEnums.CloneableTypes; |
|
|
|
|
if (obj[i].parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
if (obj[i].parent.parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].parent.parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/DiXiaLouDing/RenNengZou")]//地面的楼顶(人能走),常见为地下建筑上的小路 |
|
|
|
|
public static void DiXiaLouDingRenNengZou() |
|
|
|
|
[MenuItem("SceneTool/SetNavLayerShiWaiCarRoad")]//添加寻路层车(前提是将车的寻路层添加layer CarRoad) |
|
|
|
|
public static void SetNavLayerShiWaiCarRoad() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
if (obj[i].gameObject.layer == LayerMask.NameToLayer("CarRoad")) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
if (!obj[i].gameObject.GetComponent<NavMeshModifier>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
//Debug.Log(obj[i].name); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
@ -261,64 +280,29 @@ public class SceneTool
|
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.ShiWaiMan; |
|
|
|
|
if (obj[i].GetComponentInParent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].GetComponentInParent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().SpecialTag = "楼顶"; |
|
|
|
|
} |
|
|
|
|
CloneableEnums enumParent = obj[i].gameObject.GetComponent<CloneableEnums>(); |
|
|
|
|
Transform Template = GameObject.Find("TheCarRoad").transform; |
|
|
|
|
var CloneableEnums = Template.GetComponent<CloneableEnums>(); |
|
|
|
|
enumParent.CloneableTypes = CloneableEnums.CloneableTypes; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/DiXiaLouDing/DouBuZou")]//地面的楼顶(都不能走),常见为地下建筑上的花坛 |
|
|
|
|
public static void DiXiaLouDingDouBuZou() |
|
|
|
|
[MenuItem("SceneTool/SetNavLayerShiWaiSoldierRoad")]//添加寻路层车(前提是将车的寻路层添加layer SoliderRoad) |
|
|
|
|
public static void SetNavLayerShiWaiSoliderRoad() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("CarRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<NavMeshModifier>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<NavMeshModifier>(); |
|
|
|
|
} |
|
|
|
|
NavMeshModifier mod = obj[i].gameObject.GetComponent<NavMeshModifier>(); |
|
|
|
|
mod.overrideArea = true; |
|
|
|
|
mod.area = 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/PuTongLouDing/RenNengZou")]//普通的楼顶(人能走),常见为地上建筑的楼顶地板 |
|
|
|
|
public static void PuTongLouDingRenNengZou() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
if (obj[i].gameObject.layer == LayerMask.NameToLayer("SoldierRoad")) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
if (!obj[i].gameObject.GetComponent<NavMeshModifier>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
//Debug.Log(obj[i].name); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
@ -327,276 +311,163 @@ public class SceneTool
|
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.LouDing; |
|
|
|
|
if (obj[i].GetComponentInParent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
FloorMessage fmg = obj[i].GetComponentInParent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.StaticGameObject; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().SpecialTag = "楼顶"; |
|
|
|
|
} |
|
|
|
|
CloneableEnums enumParent = obj[i].gameObject.GetComponent<CloneableEnums>(); |
|
|
|
|
Transform Template = GameObject.Find("TheCarRoad").transform.Find("ShiWaiSolider"); |
|
|
|
|
var CloneableEnums = Template.GetComponent<CloneableEnums>(); |
|
|
|
|
enumParent.CloneableTypes = CloneableEnums.CloneableTypes; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/PuTongLouDing/DouBuZou")]//普通的楼顶(都不能走) |
|
|
|
|
public static void PuTongLouDingDouBuZou() |
|
|
|
|
[MenuItem("SceneTool/RemoveColider")]//移除碰撞器 |
|
|
|
|
public static void RemoveColider() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<NavMeshModifier>()) |
|
|
|
|
if (obj[i].GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<NavMeshModifier>(); |
|
|
|
|
UnityEngine.Object.DestroyImmediate(obj[i].GetComponent<MeshCollider>(), true); |
|
|
|
|
} |
|
|
|
|
NavMeshModifier mod = obj[i].gameObject.GetComponent<NavMeshModifier>(); |
|
|
|
|
mod.overrideArea = true; |
|
|
|
|
mod.area = 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/ShiWai/CheNengZou")]//地面(车能走),常见为公路 |
|
|
|
|
public static void ShiWaiCheNengZou() |
|
|
|
|
[MenuItem("SceneTool/AddColider")]//添加碰撞器 |
|
|
|
|
public static void AddColider() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("CarRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
if (!obj[i].GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<PathFindable>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.ShiWaiCar; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/ShiWai/RenNengZou")]//地面(人能走),常见为小路 |
|
|
|
|
public static void ShiWaiRenNengZou() |
|
|
|
|
[MenuItem("SceneTool/ChangeMessage")]//添加碰撞器 |
|
|
|
|
public static void ChangeMessage() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
if (obj[i].GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("SoldierRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
if (obj[i].GetComponent<CloneGameObjInfo>().buildNum == "8XGYTC") |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
obj[i].GetComponent<CloneGameObjInfo>().buildNum = "2XGYTC"; |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<PathFindable>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<PathFindable>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.ShiWaiMan; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/ShiWai/DouBuZou")]//地面(都不能走),常见为花坛 |
|
|
|
|
public static void ShiWaiDouBuZou() |
|
|
|
|
[MenuItem("SceneTool/RemoveAnimator")]//移除碰撞器 |
|
|
|
|
public static void RemoveAnimator() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
if (obj[i].GetComponent<Animator>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.layer = LayerMask.NameToLayer("CarRoad"); |
|
|
|
|
if (!obj[i].gameObject.GetComponent<NavMeshModifier>()) |
|
|
|
|
if (obj[i].GetComponent<Animator>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<NavMeshModifier>(); |
|
|
|
|
UnityEngine.Object.DestroyImmediate(obj[i].GetComponent<Animator>(), true); |
|
|
|
|
} |
|
|
|
|
NavMeshModifier mod = obj[i].gameObject.GetComponent<NavMeshModifier>(); |
|
|
|
|
mod.overrideArea = true; |
|
|
|
|
mod.area = 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/TeShu/YouGuanDing")]//油罐顶 |
|
|
|
|
public static void YouGuanDing() |
|
|
|
|
[MenuItem("SceneTool/SetshineiXHS")]//设置室内消火栓属性 |
|
|
|
|
public static void SetSNXHS() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
if (obj[i].name.ToLower().Contains("xhs") && |
|
|
|
|
!obj[i].name.ToLower().Contains("xhs_name") && |
|
|
|
|
!obj[i].name.ToLower().Contains("xhs_wz") && |
|
|
|
|
!obj[i].name.ToLower().Contains("xhs-wz") && |
|
|
|
|
obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.YouGuanDing; |
|
|
|
|
if (!obj[i].gameObject.GetComponent<BoxCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<BoxCollider>(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/TeShu/YouGuanBi")]//油罐壁 |
|
|
|
|
public static void YouGuanBi() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
{ |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
if (obj[i].GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
UnityEngine.Object.DestroyImmediate(obj[i].GetComponent<MeshCollider>(), true); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.YouGuanBi; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/TeShu/WeiXianPinYunShuChe")]//危险运输车 |
|
|
|
|
public static void WeiXianPinYunShuChe() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Unfiltered); |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].GetComponent<MeshRenderer>()) |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneGameObjInfo>()) |
|
|
|
|
{ |
|
|
|
|
if (!obj[i].gameObject.GetComponent<MeshCollider>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<MeshCollider>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
} |
|
|
|
|
CloneEnumsHelp cloneEnumsHelp = obj[i].gameObject.GetComponent<CloneEnumsHelp>(); |
|
|
|
|
cloneEnumsHelp.cloneOnFloorType = CloneOnFloorType.WeiXianPinYunShuChe; |
|
|
|
|
obj[i].gameObject.AddComponent<CloneGameObjInfo>(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
[MenuItem("SceneTool/AddNewScripts")]//优化增加新的脚本 |
|
|
|
|
public static void AddNewScripts() |
|
|
|
|
{ |
|
|
|
|
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep); |
|
|
|
|
for (int i = 0; i < obj.Length; i++) |
|
|
|
|
{ |
|
|
|
|
if (obj[i].gameObject.activeInHierarchy && obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneEnumsHelp>()) |
|
|
|
|
if (obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjID == 0) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.AddComponent<CloneEnumsHelp>(); |
|
|
|
|
long staticGameObjId = (long)GUID.NewGuid(1, 1); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().SetGameObjID(staticGameObjId); |
|
|
|
|
} |
|
|
|
|
var count = obj[i].GetComponent<CloneableEnums>().CloneableTypes.Count; |
|
|
|
|
if (count == 80)// 室外车能走 |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.IndoorFireHydrant; |
|
|
|
|
if (!obj[i].gameObject.GetComponent<InDoorHydrantMessage>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.GetComponent<CloneEnumsHelp>().cloneOnFloorType = CloneOnFloorType.ShiWaiCar; |
|
|
|
|
obj[i].gameObject.AddComponent<InDoorHydrantMessage>(); |
|
|
|
|
} |
|
|
|
|
else if (count == 35 && hasParentByName(obj[i].gameObject, "shinei"))// 室内人能走 |
|
|
|
|
if (!obj[i].gameObject.GetComponent<WaterSource>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.GetComponent<CloneEnumsHelp>().cloneOnFloorType = CloneOnFloorType.ShiNeiMan; |
|
|
|
|
obj[i].gameObject.AddComponent<WaterSource>(); |
|
|
|
|
} |
|
|
|
|
else if (count == 35 && hasParentByName(obj[i].gameObject, "shiwai"))// 楼顶 |
|
|
|
|
if (!obj[i].gameObject.GetComponent<CloneableEnums>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.GetComponent<CloneEnumsHelp>().cloneOnFloorType = CloneOnFloorType.LouDing; |
|
|
|
|
obj[i].gameObject.AddComponent<CloneableEnums>(); |
|
|
|
|
} |
|
|
|
|
else if (count == 47)// 室外人能走 |
|
|
|
|
CloneableEnums enumParent = obj[i].gameObject.GetComponent<CloneableEnums>(); |
|
|
|
|
|
|
|
|
|
List<CloneObjType> EnumsList = new List<CloneObjType>() { |
|
|
|
|
CloneObjType.FireHose |
|
|
|
|
}; |
|
|
|
|
enumParent.CloneableTypes = EnumsList; |
|
|
|
|
if (obj[i].parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.GetComponent<CloneEnumsHelp>().cloneOnFloorType = CloneOnFloorType.ShiWaiMan; |
|
|
|
|
FloorMessage fmg = obj[i].parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.IndoorFireHydrant; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
else if (obj[i].gameObject.GetComponent<InDoorHydrantMessage>())// 室内消火栓 |
|
|
|
|
if (obj[i].parent.parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
obj[i].gameObject.GetComponent<CloneEnumsHelp>().cloneOnFloorType = CloneOnFloorType.ShiNeiXHS; |
|
|
|
|
FloorMessage fmg = obj[i].parent.parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.IndoorFireHydrant; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
if (obj[i].parent.parent.parent.GetComponent<FloorMessage>()) |
|
|
|
|
{ |
|
|
|
|
Debug.Log("警告,有对象没有绑定上脚本" + obj[i].name); |
|
|
|
|
FloorMessage fmg = obj[i].parent.parent.parent.GetComponent<FloorMessage>(); |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().gameObjType = CloneObjType.IndoorFireHydrant; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().buildNum = fmg.buildNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().floorNum = fmg.floorNum; |
|
|
|
|
obj[i].gameObject.GetComponent<CloneGameObjInfo>().interlayerNum = fmg.interlayerNum; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
private static bool hasParentByName(GameObject gameObject, string parentName) |
|
|
|
|
{ |
|
|
|
|
if (gameObject.transform.parent) |
|
|
|
|
{ |
|
|
|
|
if (gameObject.transform.parent.name == parentName) |
|
|
|
|
{ |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
return hasParentByName(gameObject.transform.parent.gameObject, parentName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |