using System.Collections; using System.Collections.Generic; using UnityEngine; using AX.InputSystem; using System; public class Cloneable : GameObjectCloneable { //克隆地点需要限制的克隆类型 private List CloneableTypes = new List(); void Start() { for (int i = (int)CloneObjType.HighSprayingTruck; i <= (int)CloneObjType.WhiteCar; i++)//车辆 { CloneableTypes.Add((CloneObjType)i); } for (int i = (int)CloneObjType.SafetyOfficer; i <= (int)CloneObjType.VolunteerFireman; i++)//人员 { CloneableTypes.Add((CloneObjType)i); } for (int i = (int)CloneObjType.Wounded; i <= (int)CloneObjType.FireMan; i++)//灾情 { CloneableTypes.Add((CloneObjType)i); } for (int i = (int)CloneObjType.WarningLine; i <= (int)CloneObjType.InitialSave; i++)//工具 { CloneableTypes.Add((CloneObjType)i); } for (int i = (int)CloneObjType.BaseStation4G; i <= (int)CloneObjType.IntegratedPlatform; i++)//通讯保障 { CloneableTypes.Add((CloneObjType)i); } for (int i = (int)CloneObjType.RemoteWaterSupplyTruck; i <= (int)CloneObjType.DryPowderFireTruck; i++)//新增车辆 { CloneableTypes.Add((CloneObjType)i); } CloneableTypes.Add(CloneObjType.FireOpenType);//敞开式燃烧 CloneableTypes.Add(CloneObjType.NaturalWater);//天然水源 CloneableTypes.Add(CloneObjType.SafeArea);//安全区 CloneableTypes.Add(CloneObjType.PressureConnection);//试压口 CloneableTypes.Add(CloneObjType.SemifixedDevice);//半固定注水装置 CloneableTypes.Add(CloneObjType.TankCar);//槽罐车 CloneableTypes.Add(CloneObjType.TrafficPoliceCar);//交警车 CloneableTypes.Add(CloneObjType.EnvironmentalCar);//环保车 CloneableTypes.Add(CloneObjType.WeatherBureauCar);//气象车 CloneableTypes.Add(CloneObjType.PowerSupplyCar);//供电局车 } public override bool GetCloneAble(GameObject hitObj, CloneObjType cloneObjType) { bool clone = false; //如果是受克隆地点限制需要判断能否在该地点克隆 if (CloneableTypes.Contains(cloneObjType)) { var cloneableEnums = hitObj.GetComponent(); if (cloneableEnums && cloneableEnums.CloneableTypes.Contains(cloneObjType)) { clone = true; } } //如果不受克隆地点限制直接能克隆 else { clone = true; } return clone; } }