public CSCreator MultiCreateCreator(int TeamNum) { if (otherCreators.ContainsKey(TeamNum)) { Debug.Log("This TeamNum [" + TeamNum.ToString() + "] is exsit"); return(null); } CSCreator creator = null; GameObject go = new GameObject(); go.transform.parent = transform; go.name = "Team " + TeamNum + " Managed Creator"; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; CSMgCreator mgCreator = go.AddComponent <CSMgCreator>(); creator = mgCreator; CSConst.CreatorType type = CSConst.CreatorType.Managed; creator.m_DataInst = CSDataMgr.CreateDataInst(TeamNum, type); mgCreator.m_Clod = CSClodsMgr.CreateClod(TeamNum); mgCreator.teamNum = TeamNum; otherCreators.Add(TeamNum, creator); return(creator); }
void RPC_S2C_CLN_SetDwellingsID(uLink.BitStream stream, uLink.NetworkMessageInfo info) { //--to do: wait int dwllingsID = stream.Read <int>(); //int playID = stream.Read<int>(); //if (playID != PlayerFactory.mMainPlayer.OwnerView.viewID.id) //{ CSMgCreator creator = MultiColonyManager.GetCreator(TeamId, false); if (creator != null) { CSPersonnel[] personnels = creator.GetNpcs(); foreach (CSPersonnel csp in personnels) { if (csp != null && csp.m_Npc != null) { if (Id == csp.m_Npc.Id) { CSDwellings cd = creator.GetCommonEntity(dwllingsID) as CSDwellings; cd.AddNpcs(csp); } } } } //} }
// void RPC_S2C_CLN_SetGuardPos(uLink.BitStream stream, uLink.NetworkMessageInfo info) // { // //--to do: wait // Vector3 guardPos = stream.Read<Vector3>(); // //int playID = stream.Read<int>(); // //if (playID == PlayerFactory.mMainPlayer.OwnerView.viewID.id) // //{ // CSCreator creator = CSMain.GetCreator(CSConst.ciDefMgCamp); // if (creator != null) // { // CSPersonnel[] personnels = creator.GetNpcs(); // foreach (CSPersonnel csp in personnels) // { // if (csp != null && csp.m_Npc != null) // { // if (Id == csp.m_Npc.Id) // { // csp.SetGuardAttr(guardPos); // } // } // } // } // //} // } void RPC_S2C_CLN_PlantGetBack(uLink.BitStream stream, uLink.NetworkMessageInfo info) { int objId = stream.Read <int> (); if (objId != -1) { FarmManager.Instance.RemovePlant(objId); DragArticleAgent.Destory(objId); ItemMgr.Instance.DestroyItem(objId); } else { FarmPlantLogic plant = stream.Read <FarmPlantLogic>(); CSMgCreator creator = MultiColonyManager.GetCreator(TeamId); if (creator == null || creator.Assembly == null) { return; } CSFarm farm = creator.Assembly.Farm; if (farm == null) { return; } farm.RestoreWateringPlant(plant); } }
public static void StopTraining(PeEntity npc) { CSMgCreator creator = null; if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return; } creator = MultiColonyManager.GetCreator(npcnet.TeamId); } else { creator = s_MgCreator; } if (creator == null) { return; } //find npc if (creator.Assembly == null) { return; } }
public static List <CSPersonnel> GetTraineeList() { CSMgCreator creator = null; creator = s_MgCreator; List <CSPersonnel> result = new List <CSPersonnel>(); if (s_MgCreator.Assembly == null) { return(null); } CSTraining cst = s_MgCreator.Assembly.TrainingCenter; if (cst == null) { return(null); } foreach (int id in cst.TraineeList) { CSPersonnel csp = creator.GetNpc(id); if (csp != null) { result.Add(csp); } } return(result); }
void RPC_S2C_DWL_SyncNpc(uLink.BitStream stream, uLink.NetworkMessageInfo info) { int[] npcs = stream.Read <int[]>(); foreach (int npcId in npcs) { if (npcId != 0) { CSDwellings dwl = m_Entity as CSDwellings; CSPersonnel csNpc; //-- to do: CSMgCreator creator = MultiColonyManager.GetCreator(TeamId, false); if (creator != null) { csNpc = creator.GetNpc(npcId); if (csNpc != null && csNpc.Dwellings != null) { csNpc.Dwellings.RemoveNpc(csNpc); } if (csNpc != null && dwl != null) { dwl.AddNpcs(csNpc); } } } } }
public List <CSEntity> GetProtectedEntities() { if (m_Creator == null) { return(new List <CSEntity>()); } CSMgCreator mgCreator = m_Creator as CSMgCreator; if (mgCreator == null) { Debug.LogWarning("The Creator is not a Managed creator, it cant produce the protected entities "); return(new List <CSEntity>()); } List <CSEntity> enties = new List <CSEntity>(); if (mgCreator.Assembly != null) { //lz-2016.07.25 把基地核心和依赖这个核心的所以设备添加到巡逻列表 enties.Add(mgCreator.Assembly); foreach (KeyValuePair <CSConst.ObjectType, List <CSCommon> > kv in mgCreator.Assembly.m_BelongObjectsMap) { for (int i = 0; i < kv.Value.Count; i++) { enties.Add(kv.Value[i]); } } } return(enties); }
public void CheckFinish(int npcId, List <CSTreatment> csts) { //CSMain.Instance.RemoveCounter(m_Counter); StopCounter(); PeEntity npc = EntityMgr.Instance.Get(npcId); int teamId = _ColonyObj._Network.TeamId; CSMgCreator creator = MultiColonyManager.GetCreator(teamId); creator.RemoveNpcTreatment(npcId); if (csts != null && csts.Count > 0) { creator.AddTreatment(csts); npc.GetCmpt <NpcCmpt>().MedicalState = ENpcMedicalState.SearchTreat; } else { npc.GetCmpt <NpcCmpt>().MedicalState = ENpcMedicalState.Cure; } allPatients.RemoveAll(it => it.Id == npcId); Data.npcIds.Remove(npcId); isNpcReady = false; if (allPatients.Count >= 1) { SetPatientIcon(m_Creator.GetNpc(allPatients[0].Id)); allPatients[0].GetCmpt <NpcCmpt>().MedicalState = ENpcMedicalState.SearchDiagnos; } else { SetPatientIcon(null); } RefreshTreatment(); }
public static CSMedicalTent FindTentMachine(PeEntity npc) { CSMgCreator creator = null; if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return(null); } creator = MultiColonyManager.GetCreator(npcnet.TeamId); } else { creator = s_MgCreator; } if (creator.Assembly == null) { return(null); } if (creator.Assembly.MedicalTent != null && creator.Assembly.MedicalTent.IsRunning) { return(creator.Assembly.MedicalTent); } else { return(null); } }
// CSClodMgr void OnDirtyVoxel(Vector3 pos, byte terrainType) { #if NEW_CLOD_MGR foreach (KeyValuePair <int, CSCreator> kvp in m_Creators) { CSMgCreator mgCreator = kvp.Value as CSMgCreator; if (mgCreator == null) { continue; } if (mgCreator.Assembly != null && mgCreator.Assembly.InLargestRange(pos) && mgCreator.m_Clod != null) { RaycastHit rch; Vector3 realPos = Vector3.zero; if (Physics.Raycast(pos + new Vector3(0, 1, 0), Vector3.down, out rch, 2, 1 << Pathea.Layer.VFVoxelTerrain)) { realPos = rch.point; } else { realPos = pos; } if (!FarmManager.Instance.mPlantHelpMap.ContainsKey(new IntVec3(pos))) { mgCreator.m_Clod.AddClod(realPos, false); } else { mgCreator.m_Clod.AddClod(realPos, true); } } } #else CSMgCreator creator = GetCreator(CSConst.ciDefMgCamp) as CSMgCreator; if (creator.Assembly != null && creator.Assembly.InRange(pos)) { RaycastHit rch; Vector3 realPos = Vector3.zero; if (Physics.Raycast(pos + new Vector3(0, 1, 0), Vector3.down, out rch, 2, 1 << Pathea.Layer.VFVoxelTerrain)) { realPos = rch.point; } else { realPos = pos; } if (!FarmManager.mPlantHelpMap.ContainsKey(new IntVec3(pos))) { CSClodMgr.AddClod(realPos, false); } else { CSClodMgr.AddClod(realPos, true); } } #endif }
void Start() { if (!GameConfig.IsMultiMode) { m_Type = GetMTypeFromProtoId(itemDrag.itemObj.protoId); CSMgCreator creator = CSMain.s_MgCreator; if (creator != null) { CSEntityAttr attr = new CSEntityAttr(); attr.m_InstanceId = InstanceId; attr.m_protoId = protoId; attr.m_Type = (int)m_Type; attr.m_Pos = transform.position; attr.m_LogicObj = gameObject; //attr.m_Bound = GetObjectBounds(); //attr.m_Bound.center = transform.TransformPoint(attr.m_Bound.center); //attr.m_ColonyBase = _ColonyObj; int r = creator.CreateEntity(attr, out m_Entity); if (r != CSConst.rrtSucceed) { Debug.LogError("Error with Init Entities"); return; } _peEntity = gameObject.GetComponent <PeEntity>(); _peTrans = gameObject.GetComponent <PeTrans>(); _skEntity = gameObject.GetComponent <PESkEntity>(); _skEntity.m_Attrs = new PESkEntity.Attr[5]; _skEntity.m_Attrs[0] = new PESkEntity.Attr(); _skEntity.m_Attrs[1] = new PESkEntity.Attr(); _skEntity.m_Attrs[2] = new PESkEntity.Attr(); _skEntity.m_Attrs[3] = new PESkEntity.Attr(); _skEntity.m_Attrs[4] = new PESkEntity.Attr(); _skEntity.m_Attrs[0].m_Type = AttribType.HpMax; _skEntity.m_Attrs[1].m_Type = AttribType.Hp; _skEntity.m_Attrs[2].m_Type = AttribType.CampID; _skEntity.m_Attrs[3].m_Type = AttribType.DefaultPlayerID; _skEntity.m_Attrs[4].m_Type = AttribType.DamageID; _skEntity.m_Attrs[0].m_Value = m_Entity.MaxDurability; _skEntity.m_Attrs[1].m_Value = m_Entity.CurrentDurability; _skEntity.m_Attrs[2].m_Value = PeCreature.Instance.mainPlayer.GetAttribute(AttribType.CampID); _skEntity.m_Attrs[3].m_Value = ForceConstant.PLAYER; _skEntity.m_Attrs[4].m_Value = PeCreature.Instance.mainPlayer.GetAttribute(AttribType.DamageID); _skEntity.onHpChange += OnHpChange; if (m_Type == CSConst.ObjectType.Assembly) { _skEntity.onHpChange += SendHpChangeMessage; } _skEntity.deathEvent += OnDeathEvent; _skEntity.InitEntity(); m_Entity.onDuraChange = SetHp; OnHpChange(_skEntity, 0); int entityId = Pathea.WorldInfoMgr.Instance.FetchNonRecordAutoId(); EntityMgr.Instance.InitEntity(entityId, _peEntity.gameObject); creator.AddLogic(id, this); } StartCoroutine(SetFirstConstruct()); } }
public static CSMedicalTent FindMedicalTent(out bool isReady, PeEntity npc, out Sickbed sickBed) { isReady = false; sickBed = null; if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return(null); } CSMgCreator creator = MultiColonyManager.GetCreator(npcnet.TeamId); if (creator.Assembly == null) { return(null); } if (creator.Assembly.MedicalTent == null) { return(null); } CSMedicalTent tent = creator.Assembly.MedicalTent; if (!tent.IsRunning) { return(null); } sickBed = tent.CheckNpcBed(npc); if (sickBed == null) { tent._ColonyObj._Network.RPCServer(EPacketType.PT_CL_TET_FindMachine, npc.Id); } else { isReady = true; } return(tent); } else { if (s_MgCreator.Assembly == null) { return(null); } if (s_MgCreator.Assembly.MedicalTent == null) { return(null); } CSMedicalTent tent = s_MgCreator.Assembly.MedicalTent; if (!tent.IsRunning) { return(null); } isReady = tent.IsReady(npc, out sickBed); tent.AppointTent(npc); return(tent); } }
public static CSMedicalCheck FindMedicalCheck(out bool isReady, PeEntity npc) { isReady = false; if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return(null); } CSMgCreator creator = MultiColonyManager.GetCreator(npcnet.TeamId); if (creator.Assembly == null) { return(null); } if (creator.Assembly.MedicalCheck == null) { return(null); } CSMedicalCheck check = creator.Assembly.MedicalCheck; if (!check.IsRunning) { return(null); } isReady = check.IsReady(npc); if (npc.GetCmpt <NpcCmpt>().illAbnormals != null && npc.GetCmpt <NpcCmpt>().illAbnormals.Count > 0) { check._ColonyObj._Network.RPCServer(EPacketType.PT_CL_CHK_FindMachine, npc.Id); } return(check); } else { if (s_MgCreator.Assembly == null) { return(null); } if (s_MgCreator.Assembly.MedicalCheck == null) { return(null); } CSMedicalCheck detector = s_MgCreator.Assembly.MedicalCheck; if (!detector.IsRunning) { return(null); } isReady = detector.IsReady(npc); detector.AppointCheck(npc); return(detector); } }
public static CSMedicalTreat FindMedicalTreat(out bool isReady, PeEntity npc) { isReady = false; if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return(null); } CSMgCreator creator = MultiColonyManager.GetCreator(npcnet.TeamId); if (creator.Assembly == null) { return(null); } if (creator.Assembly.MedicalTreat == null) { return(null); } CSMedicalTreat treat = creator.Assembly.MedicalTreat; if (!treat.IsRunning) { return(null); } isReady = treat.IsReady(npc); treat._ColonyObj._Network.RPCServer(EPacketType.PT_CL_TRT_FindMachine, npc.Id); return(treat); } else { if (s_MgCreator.Assembly == null) { return(null); } if (s_MgCreator.Assembly.MedicalTreat == null) { return(null); } CSMedicalTreat lab = s_MgCreator.Assembly.MedicalTreat; if (!lab.IsRunning) { return(null); } isReady = lab.IsReady(npc); lab.AppointTreat(npc); return(lab); } //--to do: inform player need treat //return null; }
// Update is called once per frame void Update() { if (RefNpc == null) { return; } //bool isNeedFuillTip = false; CSMgCreator mgCreator = RefNpc.m_Creator as CSMgCreator; if (mgCreator != null) { if (mgCreator.Assembly != null) { int farmCnt = mgCreator.Assembly.GetEntityCnt(CSConst.ObjectType.Farm); int maxFarmCnt = mgCreator.Assembly.GetLimitCnt(CSConst.ObjectType.Farm); m_FarmUI.text = "[" + farmCnt.ToString() + "/" + maxFarmCnt.ToString() + "]"; if (farmCnt != 0) { CSFarm farm = mgCreator.Assembly.m_BelongObjectsMap[CSConst.ObjectType.Farm][0] as CSFarm; int curFarmerCnt = farm.WorkerCount; int maxFarmerCnt = farm.WorkerMaxCount; m_TotalFamersUI.text = curFarmerCnt.ToString() + "/" + maxFarmerCnt.ToString(); //if (curFarmerCnt >= maxFarmerCnt) // isNeedFuillTip = true; if (curFarmerCnt >= maxFarmerCnt) { m_TotalFamersUI.color = Color.red; } else { m_TotalFamersUI.color = Color.white; } } else { m_TotalFamersUI.text = "0/0"; } m_MangeNumUI.text = mgCreator.FarmMgNum.ToString(); m_HarvestNumUI.text = mgCreator.FarmHarvestNum.ToString(); m_PlantNumUI.text = mgCreator.FarmPlantNum.ToString(); } } m_FullTipUI.gameObject.SetActive(false); }
public void ClearFarmWorks() { if (WorkRoom == null) { return; } CSFarm farm = WorkRoom as CSFarm; if (farm == null) { m_FarmWorkMap.Clear(); return; } foreach (KeyValuePair <EFarmWorkType, FarmWorkInfo> kvp in m_FarmWorkMap) { switch (kvp.Key) { case EFarmWorkType.Watering: farm.RestoreWateringPlant(kvp.Value.m_Plant); break; case EFarmWorkType.Cleaning: farm.RestoreCleaningPlant(kvp.Value.m_Plant); break; case EFarmWorkType.Harvesting: farm.RestoreRipePlant(kvp.Value.m_Plant); break; case EFarmWorkType.Planting: #if NEW_CLOD_MGR CSMgCreator mgCreator = m_Creator as CSMgCreator; if (mgCreator == null) { Debug.Log(" CSCreator is error"); break; } mgCreator.m_Clod.DirtyTheChunk(kvp.Value.m_ClodChunk.m_ChunkIndex, false); #else CSClodMgr.DirtyTheChunk(kvp.Value.m_ClodChunk.m_ChunkIndex, false); #endif break; } } m_FarmWorkMap.Clear(); }
void RPC_S2C_CLN_PlantClean(uLink.BitStream stream, uLink.NetworkMessageInfo info) { /*int farmId = */ stream.Read <int>(); FarmPlantLogic plant = stream.Read <FarmPlantLogic>(); CSMgCreator creator = MultiColonyManager.GetCreator(TeamId); if (creator == null || creator.Assembly == null) { return; } CSFarm farm = creator.Assembly.Farm; farm.RestoreCleaningPlant(plant); }
public static List <PeEntity> GetCSBuildings(CSCreator creator) { List <PeEntity> allbuildings = new List <PeEntity>(); CSMgCreator mgCreater = creator as CSMgCreator; if (mgCreater != null) { foreach (CSBuildingLogic csb in mgCreater.allBuildingLogic.Values) { allbuildings.Add(csb._peEntity); } } return(allbuildings); }
public void InitNPC() { CSMgCreator mgC = m_Creator as CSMgCreator; if (mgC != null) { foreach (CSPersonnel csp in mgC.Farmers) { if (!AddWorker(csp)) { continue; } csp.WorkRoom = this; } } }
public static bool HasBuilding(int protoId, CSCreator creator) { CSMgCreator mgCreater = creator as CSMgCreator; if (mgCreater != null) { foreach (CSBuildingLogic csb in mgCreater.allBuildingLogic.Values) { if (csb != null && csb.protoId == protoId) { return(true); } } } return(false); }
void InitNPC() { CSMgCreator mgC = m_Creator as CSMgCreator; if (mgC != null) { foreach (CSPersonnel csp in mgC.Processors) { if (!AddWorker(csp)) { continue; } csp.WorkRoom = this; InitNpcProcessingIndex(csp); } } }
public CSCreator CreateCreator(int ID, string desc, CSConst.CreatorType type = CSConst.CreatorType.Managed) { if (m_Creators.ContainsKey(ID)) { Debug.Log("This ID [" + ID.ToString() + "] is exsit"); return(null); } CSCreator creator = null; if (type == CSConst.CreatorType.Managed) { GameObject go = new GameObject(); go.transform.parent = transform; go.name = desc; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; CSMgCreator mgCreator = go.AddComponent <CSMgCreator>(); creator = mgCreator; creator.m_DataInst = CSDataMgr.CreateDataInst(ID, type); mgCreator.m_Clod = CSClodsMgr.CreateClod(ID); m_Creators.Add(ID, creator); } else if (type == CSConst.CreatorType.NoManaged) { GameObject go = new GameObject(); go.transform.parent = transform; go.name = desc; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; creator = go.AddComponent <CSNoMgCreator>(); creator.m_DataInst = CSDataMgr.CreateDataInst(ID, type); m_Creators.Add(ID, creator); } return(creator); }
public static void KickOutFromHospital(PeEntity npc) { CSMgCreator creator = null; if (PeGameMgr.IsMulti) { if (PeGameMgr.IsCustom) { return; } NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return; } creator = MultiColonyManager.GetCreator(npcnet.TeamId); } else { creator = s_MgCreator; } if (creator == null) { return; } //find npc if (creator.Assembly == null) { return; } if (creator.Assembly.MedicalCheck != null && creator.Assembly.MedicalCheck.IsRunning) { creator.Assembly.MedicalCheck.RemoveDeadPatient(npc.Id); } if (creator.Assembly.MedicalTreat != null && creator.Assembly.MedicalTreat.IsRunning) { creator.Assembly.MedicalTreat.RemoveDeadPatient(npc.Id); } if (creator.Assembly.MedicalTent != null && creator.Assembly.MedicalTent.IsRunning) { creator.Assembly.MedicalTent.RemoveDeadPatient(npc.Id); } creator.m_TreatmentList.RemoveAll(it => it.npcId == npc.Id); }
void OnRemovePlant(FarmPlantLogic plant) { #if NEW_CLOD_MGR foreach (KeyValuePair <int, CSCreator> kvp in m_Creators) { CSMgCreator mgCreator = kvp.Value as CSMgCreator; if (mgCreator == null) { continue; } mgCreator.m_Clod.DirtyTheClod(plant.mPos, false); } #else CSClodMgr.DirtyTheClod(plant.mPos, false); #endif }
public static bool TryGetCheck(PeEntity npc) { if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return(false); } CSMgCreator creator = MultiColonyManager.GetCreator(npcnet.TeamId); if (creator.Assembly == null) { return(false); } if (creator.Assembly.MedicalCheck == null) { return(false); } CSMedicalCheck detector = creator.Assembly.MedicalCheck; if (!detector.IsRunning) { return(false); } detector._ColonyObj._Network.RPCServer(EPacketType.PT_CL_CHK_TryStart, npc.Id); } else { if (s_MgCreator.Assembly == null) { return(false); } if (s_MgCreator.Assembly.MedicalCheck == null) { return(false); } CSMedicalCheck detector = s_MgCreator.Assembly.MedicalCheck; if (!detector.IsRunning) { return(false); } //--to do : check npc detector return(detector.StartCheck(npc)); } return(false); }
public static bool HasBuilding(int protoId, CSCreator creator, out Vector3 pos) { CSMgCreator mgCreater = creator as CSMgCreator; pos = Vector3.zero; if (mgCreater != null) { foreach (CSBuildingLogic csb in mgCreater.allBuildingLogic.Values) { if (csb != null && csb.protoId == protoId) { pos = csb.transform.position; return(true); } } } return(false); }
public static bool TryGetTent(PeEntity npc) { if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return(false); } CSMgCreator creator = MultiColonyManager.GetCreator(npcnet.TeamId); if (creator.Assembly == null) { return(false); } if (creator.Assembly.MedicalTent == null) { return(false); } CSMedicalTent tent = creator.Assembly.MedicalTent; if (!tent.IsRunning) { return(false); } tent._ColonyObj._Network.RPCServer(EPacketType.PT_CL_TET_TryStart, npc.Id); } else { if (s_MgCreator.Assembly == null) { return(false); } if (s_MgCreator.Assembly.MedicalTent == null) { return(false); } CSMedicalTent tent = s_MgCreator.Assembly.MedicalTent; if (!tent.IsRunning) { return(false); } return(tent.StartTent(npc)); } return(false); }
void OnDigTerrain(IntVector3 pos) { #if NEW_CLOD_MGR foreach (KeyValuePair <int, CSCreator> kvp in m_Creators) { CSMgCreator mgCreator = kvp.Value as CSMgCreator; if (mgCreator == null) { continue; } mgCreator.m_Clod.DeleteClod(pos); VFVoxel voxel = VFVoxelTerrain.self.Voxels.SafeRead(pos.x, pos.y - 1, pos.z); if ((voxel.Type == PlantConst.DIRTY_TYPE0 || voxel.Type == PlantConst.DIRTY_TYPE1) && voxel.Volume > 128) { RaycastHit rch; if (Physics.Raycast(pos, Vector3.down, out rch, 2, 1 << Pathea.Layer.VFVoxelTerrain)) { mgCreator.m_Clod.AddClod(rch.point, false); } else { mgCreator.m_Clod.AddClod(new Vector3(pos.x, pos.y - 0.7f, pos.z), false); } } } #else CSClodMgr.DeleteClod(pos); VFVoxel voxel = VFVoxelTerrain.self.Voxels.SafeRead(pos.x, pos.y - 1, pos.z); if (voxel.Type == CSClodMgr.TerrainType) { RaycastHit rch; if (Physics.Raycast(pos, Vector3.down, out rch, 2, 1 << Pathea.Layer.VFVoxelTerrain)) { CSClodMgr.AddClod(rch.point, false); } else { CSClodMgr.AddClod(new Vector3(pos.x, pos.y - 0.7f, pos.z), false); } } #endif }
public static CSPersonnel GetColonyNpc(int id) { CSMgCreator creator = null; if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(id); if (npcnet == null) { return(null); } creator = MultiColonyManager.GetCreator(npcnet.TeamId); } else { creator = s_MgCreator; } return(creator.GetNpc(id)); }
void RPC_S2C_CLN_SetIsProcessing(uLink.BitStream stream, uLink.NetworkMessageInfo info) { bool isProcessing = stream.Read <bool>(); CSMgCreator creator = MultiColonyManager.GetCreator(TeamId, false); if (creator != null) { CSPersonnel[] personnels = creator.GetNpcs(); foreach (CSPersonnel csp in personnels) { if (csp != null && csp.m_Npc != null) { if (Id == csp.m_Npc.Id) { csp.IsProcessing = isProcessing; } } } } }