private void SelectCreepingNodes() { global::Empire empire = this.PlayerControllerRepositoryService.ActivePlayerController.Empire as global::Empire; if (this.City.Empire.Index == empire.Index && empire.SimulationObject.Tags.Contains("FactionTraitMimics1")) { DepartmentOfCreepingNodes agency = empire.GetAgency <DepartmentOfCreepingNodes>(); if (agency.Nodes.Count > 0) { ReadOnlyCollection <IWorldEntityWithCulling> readOnlyCollection; if (this.worldEntityCullingService.TryGetVisibleEntities <WorldCreepingNode>(out readOnlyCollection)) { for (int i = 0; i < readOnlyCollection.Count; i++) { WorldCreepingNode worldCreepingNode = readOnlyCollection[i] as WorldCreepingNode; if (worldCreepingNode != null && worldCreepingNode.CreepingNode != null && worldCreepingNode.CreepingNode.Empire.Index == empire.Index) { this.ELCPDrawCreepingNode(worldCreepingNode.CreepingNode); } } return; } for (int j = 0; j < agency.Nodes.Count; j++) { CreepingNode creepingNode = agency.Nodes[j]; this.ELCPDrawCreepingNode(creepingNode); } } } }
internal virtual void OnEmpireEliminated(global::Empire empire, bool authorized) { DepartmentOfDefense agency = base.GetAgency <DepartmentOfDefense>(); if (agency != null) { agency.OnEmpireEliminated(empire, authorized); } DepartmentOfEducation agency2 = base.GetAgency <DepartmentOfEducation>(); if (agency2 != null) { agency2.OnEmpireEliminated(empire, authorized); } DepartmentOfTheInterior agency3 = base.GetAgency <DepartmentOfTheInterior>(); if (agency3 != null) { agency3.OnEmpireEliminated(empire, authorized); } DepartmentOfCreepingNodes agency4 = base.GetAgency <DepartmentOfCreepingNodes>(); if (agency4 != null) { agency4.OnEmpireEliminated(empire, authorized); } DepartmentOfTheTreasury agency5 = base.GetAgency <DepartmentOfTheTreasury>(); if (agency5 != null) { agency5.OnEmpireEliminated(empire, authorized); } }
public static bool IsRegionValidForExploration(global::Empire empire, int regionIndex) { Diagnostics.Assert(AIScheduler.Services != null); IWorldAtlasAIHelper service = AIScheduler.Services.GetService <IWorldAtlasAIHelper>(); Diagnostics.Assert(service != null); if (empire != null) { DepartmentOfForeignAffairs agency = empire.GetAgency <DepartmentOfForeignAffairs>(); if (agency != null && !agency.CanMoveOn(regionIndex, false)) { return(false); } } DepartmentOfTheInterior agency2 = empire.GetAgency <DepartmentOfTheInterior>(); if (agency2 != null) { bool flag = false; for (int i = 0; i < agency2.Cities.Count; i++) { if (agency2.Cities[i].Region.ContinentID == service.Regions[regionIndex].ContinentID) { flag = true; break; } } if (agency2.Cities.Count == 0) { flag = true; } if (!flag) { DepartmentOfCreepingNodes agency3 = empire.GetAgency <DepartmentOfCreepingNodes>(); if (agency3 != null) { using (List <CreepingNode> .Enumerator enumerator = agency3.Nodes.GetEnumerator()) { while (enumerator.MoveNext()) { if (!enumerator.Current.IsUnderConstruction && AILayer_Exploration.IsTravelAllowedInNode(empire, enumerator.Current) && enumerator.Current.Region.ContinentID == service.Regions[regionIndex].ContinentID) { flag = true; break; } } } } } if (!flag) { return(false); } } return(!service.IsRegionExplored(empire.Index, regionIndex, 0.95f)); }
public void ComputeConnectedRegion(global::Empire empire, ref List <int> connectedRegion, Func <Region, bool> match = null) { DepartmentOfCreepingNodes agency = empire.GetAgency <DepartmentOfCreepingNodes>(); DepartmentOfTheInterior agency2 = empire.GetAgency <DepartmentOfTheInterior>(); DepartmentOfForeignAffairs agency3 = empire.GetAgency <DepartmentOfForeignAffairs>(); Diagnostics.Assert(agency2 != null); bool flag = false; for (int i = 0; i < agency2.Cities.Count; i++) { Region region = agency2.Cities[i].Region; if (match == null || match(region)) { connectedRegion.Add(region.Index); } for (int j = 0; j < region.Borders.Length; j++) { Region region2 = this.world.Regions[region.Borders[j].NeighbourRegionIndex]; if (region2.IsOcean) { flag = true; } if ((region2.City == null || region2.City.Empire != empire) && !connectedRegion.Contains(region2.Index) && (match == null || match(region2))) { connectedRegion.Add(region2.Index); } } } if (agency != null && agency3 != null) { foreach (CreepingNode creepingNode in agency.Nodes) { if (!creepingNode.IsUnderConstruction && AILayer_Exploration.IsTravelAllowedInNode(empire, creepingNode) && agency3.CanMoveOn((int)this.worldPositionningService.GetRegionIndex(creepingNode.WorldPosition), false) && !connectedRegion.Contains(creepingNode.Region.Index) && (match == null || match(creepingNode.Region))) { connectedRegion.Add(creepingNode.Region.Index); } } } if (flag) { for (int k = 0; k < this.world.Continents.Length; k++) { Continent continent = this.world.Continents[k]; if (!continent.IsOcean && !continent.IsWasteland) { bool flag2 = false; for (int l = 0; l < agency2.Cities.Count; l++) { if (agency2.Cities[l].Region.ContinentID == continent.ID) { flag2 = true; break; } } if (!flag2) { for (int m = 0; m < continent.CostalRegionList.Length; m++) { Region region3 = this.world.Regions[continent.CostalRegionList[m]]; if (!connectedRegion.Contains(region3.Index) && (match == null || match(region3))) { connectedRegion.Add(region3.Index); } } } } } } }