using System.Collections; using System.Collections.Generic; using UnityEngine; public class CloneHeadquater : CloneSingleObj { public override void Awake() { ResourcesName = "Prefab/Tool/Headquarter"; cloneObjType = CloneObjType.Headquarters; base.Awake(); } protected override void Clone() { var hitPoint = data.hitPos; Vector3 clonedObjPos = new Vector3(hitPoint.x, hitPoint.y + Height, hitPoint.z); CheckPos(clonedObjPos); clonedObj = EntitiesManager.Instance.CreateObj(clonePrefab, clonedObjPos, transform, gameObjID); clonedObj.name = gameObjID.ToString();//名字即ID //clonedObj.name = CloneObjectTool.Instance().getCloneObjectName(cloneObjType); ////有需要的类型赋值头顶名 //string topname = CloneObjName.Instance.GetCloneNameByType(cloneObjType); SelectedObjs.gameObjs.Add(clonedObj); //设置克隆物体所在楼层属性,属性从点击的对象上获取 var hitObj = EntitiesManager.Instance.GetEntityByID(data.gameObjID); number++; CloneGameObjInfo objMsg = clonedObj.GetComponent(); objMsg.gameObjType = cloneObjType; if (hitObj.GetComponent()) { CloneGameObjInfo floorMsg = hitObj.GetComponent(); objMsg.buildNum = floorMsg.buildNum; objMsg.floorNum = floorMsg.floorNum; objMsg.interlayerNum = floorMsg.interlayerNum; } SetCloneGameObject(clonedObj); AddRecordEventClone(clonedObj.transform);//测试 } public override void SetCloneGameObject(GameObject obj) { obj.AddComponent(); //obj.AddComponent(); obj.AddComponent(); obj.AddComponent(); } public void CheckPos(Vector3 pos) { if (ReplaySetting.PlayStatus != PlayStatus.isReplay) { int count = AlongWindCheck.CheckPos(pos); if (count > 0) { ResourceLoadWindow.Instance.LoadTextHintWindow("未设置在上风向或侧风向", 2); AddRecordAlongWindPosTipEvent(); } } } private void AddRecordAlongWindPosTipEvent() { if (ReplaySetting.PlayStatus == PlayStatus.isEditor && RecordManager.Instance.recordStatus == RecordStatus.normal) { var eventData = new EventData(); eventData.time = RecordManager.Instance.RecordTimer; eventData.cloneObjType = cloneObjType; eventData.eventType = RecordEventType.AlongWindTip; RecordManager.Instance.jsonData.eventDataList.Add(eventData); } } }