void OnDestroy() { if (_airborne != null) { MonsterAirborne.DestroyAirborne(_airborne, false); } #if DestroyLeftMonster if (!isSweep) { for (int i = 0; i < _agents.Count; i++) { MonEscape(_agents [i] as SceneEntityPosAgent, transform.position); } } #endif SceneMan.RemoveSceneObjs(_agents); _agents.Clear(); if (UITowerInfo.Instance != null && _uiData != null) { UITowerInfo.Instance.Hide(); } s_Beacons.Remove(this); if (!PeGameMgr.IsMulti && null != m_Mark) { PeMap.LabelMgr.Instance.Remove(m_Mark); m_Mark = null; } if (null != CSMain.Instance) { List <CSAssembly> assemblyList = CSMain.Instance.GetAllAssemblies(); if (0 < assemblyList.Count) { for (int i = 0; i < assemblyList.Count; ++i) { CSAssembly assembly = assemblyList[i]; if (null != assembly && assembly.InRange(_position)) { DigTerrainManager.ClearColonyBlockInfo(assembly); } } } } }
// // private CSSimulatorMgr m_SimulatorMgr; // public CSSimulatorMgr SimulatorMgr { get { return m_SimulatorMgr;} } // <CETC> Create Managed Entity public override int CreateEntity(CSEntityAttr attr, out CSEntity outEnti) { outEnti = null; if (attr.m_Type == CSConst.etAssembly) { Vector3 travelPos = Vector3.zero; CSBuildingLogic csb = attr.m_LogicObj == null ? null : attr.m_LogicObj.GetComponent <CSBuildingLogic>(); //lz-2017.01.17 基地逻辑预制物体加载成功并且有传送点就用配置的传送点的位置 if (csb != null && csb.travelTrans != null) { travelPos = csb.travelTrans.position; } //lz-2017.01.17 否则就用基地核心向上偏移两米的位置 else { travelPos = m_Assembly.Position + new Vector3(0, 2, 0); } if (m_Assembly == null) { if (GameConfig.IsMultiMode && attr.m_ColonyBase == null) { return(CSConst.rrtUnkown); } outEnti = _createEntity(attr); m_Assembly.ChangeState(); if (CSMain.s_MgCreator == this) { ColonyLabel.Remove(travelPos); new ColonyLabel(travelPos); } } else if (m_Assembly.ID == attr.m_InstanceId) { outEnti = m_Assembly; outEnti.gameLogic = attr.m_LogicObj; outEnti.gameObject = attr.m_Obj; outEnti.Position = attr.m_Pos; outEnti.ItemID = attr.m_protoId; outEnti.Bound = attr.m_Bound; m_Assembly.Data.m_Alive = true; if (CSMain.s_MgCreator == this) { ColonyLabel.Remove(travelPos); new ColonyLabel(travelPos); } } else { if (m_Assembly != null) { return(CSConst.rrtHasAssembly); } } } else { if (m_CommonEntities.ContainsKey(attr.m_InstanceId)) { outEnti = m_CommonEntities[attr.m_InstanceId]; outEnti.gameLogic = attr.m_LogicObj; outEnti.gameObject = attr.m_Obj; outEnti.Position = attr.m_Pos; outEnti.ItemID = attr.m_protoId; outEnti.BaseData.m_Alive = true; outEnti.Bound = attr.m_Bound; } else { if (m_Assembly == null) { return(CSConst.rrtNoAssembly); } if (!m_Assembly.InRange(attr.m_Pos)) { return(CSConst.rrtOutOfRadius); } // Is powerplant ? CSConst.ObjectType obj_type; // if ((attr.m_Type & CSConst.etPowerPlant) != 0) // obj_type = CSConst.ObjectType.PowerPlant; // else obj_type = (CSConst.ObjectType)attr.m_Type; if (!m_Assembly.OutOfCount(obj_type)) { return(CSConst.rrtOutOfRange); } if (GameConfig.IsMultiMode && attr.m_ColonyBase == null) { return(CSConst.rrtUnkown); } outEnti = _createEntity(attr); CSCommon csc = outEnti as CSCommon; m_Assembly.AttachCommonEntity(csc); } } ExecuteEvent(CSConst.cetAddEntity, outEnti); return(CSConst.rrtSucceed); }