private void CreateNodeBoundaryIFN(CreepingNode node, WorldArea nodeArea) { Diagnostics.Assert(node != null); Diagnostics.Assert(nodeArea != null); if (base.WorldEntityFactoryService == null) { return; } if (!this.nodeBoundryObjects.ContainsKey(node.GUID)) { UnityEngine.Object @object = Resources.Load("Prefabs/Cities/VillageBoundary"); if (@object != null) { GameObject gameObject = UnityEngine.Object.Instantiate(@object) as GameObject; if (gameObject != null) { Diagnostics.Assert(base.GlobalPositionningService != null); Diagnostics.Assert(base.WorldPositionningService != null); GameObject gameObject2 = null; if (base.WorldEntityFactoryService.TryGetValue(node.PointOfInterest.GUID, out gameObject2)) { gameObject.transform.parent = gameObject2.transform; gameObject.transform.localPosition = new Vector3(0f, 0.03f, 0f); WorldAreaHexagonRenderer component = gameObject.GetComponent <WorldAreaHexagonRenderer>(); Diagnostics.Assert(component != null); if (component == null) { return; } Color color = (node.Empire == null) ? Color.grey : node.Empire.Color; component.SetColor(color); component.SetWorldArea(nodeArea.WorldPositions, node.WorldPosition, base.GlobalPositionningService); component.SetMaterialSelectionStatus(false, true, true); component.SetOnDestroyLaunchAutokillAnimation(0.5f); this.nodeBoundryObjects.Add(node.GUID, gameObject); } } } } }
private void CreateVillageBoundaryIFN() { Diagnostics.Assert(this.Village != null); Diagnostics.Assert(this.WorldArea != null); if (this.WorldEntityFactoryService == null) { return; } if (this.villageBoundaryObject == null) { UnityEngine.Object @object = Resources.Load("Prefabs/Cities/VillageBoundary"); if (@object != null) { this.villageBoundaryObject = (UnityEngine.Object.Instantiate(@object) as GameObject); if (this.villageBoundaryObject != null) { Diagnostics.Assert(base.GlobalPositionningService != null); Diagnostics.Assert(this.WorldPositionningService != null); GameObject gameObject = null; if (this.WorldEntityFactoryService.TryGetValue(this.Village.PointOfInterest.GUID, out gameObject)) { this.villageBoundaryObject.transform.parent = gameObject.transform; this.villageBoundaryObject.transform.localPosition = new Vector3(0f, 0.03f, 0f); WorldAreaHexagonRenderer component = this.villageBoundaryObject.GetComponent <WorldAreaHexagonRenderer>(); Diagnostics.Assert(component != null); if (component == null) { return; } Color color = (this.Village.Converter == null) ? Color.grey : this.Village.Converter.Color; component.SetColor(color); component.SetWorldArea(this.WorldArea.WorldPositions, this.Village.WorldPosition, base.GlobalPositionningService); component.SetMaterialSelectionStatus(false, true, true); component.SetOnDestroyLaunchAutokillAnimation(0.5f); } } } } }
private void GenerateGeometry(WorldPatch patchParent, WorldPosition attackerPosition, WorldArea battleArea, WorldArea attackerDeploymentArea, WorldArea defenderDeploymentArea) { if (this.battleZoneGameObject == null) { this.battleZoneGameObject = new GameObject("BattleArea"); this.battleDeploymentAreaAttacker = this.InstantiateGameObjectFromPrefabNameAndInitMeshFilter("Prefabs/Encounters/ArmyWorldCursorDeploymentArea", this.battleZoneGameObject, false); this.battleDeploymentAreaDefender = this.InstantiateGameObjectFromPrefabNameAndInitMeshFilter("Prefabs/Encounters/ArmyWorldCursorDeploymentArea", this.battleZoneGameObject, false); this.battleAreaBoundary = this.InstantiateGameObjectFromPrefabNameAndInitMeshFilter("Prefabs/Encounters/ArmyWorldCursorEncounterBoundary", this.battleZoneGameObject, false); } this.battleZoneGameObject.transform.parent = patchParent.RootedTransform; this.battleZoneGameObject.transform.localPosition = new Vector3(0f, 0.005f, 0f); if (this.battleAreaBoundary != null) { this.battleAreaBoundary.transform.localPosition = Vector3.zero; WorldAreaHexagonRenderer component = this.battleAreaBoundary.GetComponent <WorldAreaHexagonRenderer>(); component.SetWorldArea(battleArea, attackerPosition, base.GlobalPositionningService); component.SetMaterialSelectionStatus(false, true, true); } if (this.battleDeploymentAreaAttacker != null) { this.battleDeploymentAreaAttacker.transform.localPosition = new Vector3(0f, 0.005f, 0f); WorldAreaHexagonRenderer component2 = this.battleDeploymentAreaAttacker.GetComponent <WorldAreaHexagonRenderer>(); component2.SetWorldArea(attackerDeploymentArea, attackerPosition, base.GlobalPositionningService); Color color = this.WorldArmy.Army.Empire.Color; color.a = this.attackerAlphaValue; component2.SetColor(color); component2.SetMaterialSelectionStatus(false, true, true); } if (this.battleDeploymentAreaDefender != null) { this.battleDeploymentAreaDefender.transform.localPosition = new Vector3(0f, 0.005f, 0f); WorldAreaHexagonRenderer component3 = this.battleDeploymentAreaDefender.GetComponent <WorldAreaHexagonRenderer>(); component3.SetWorldArea(defenderDeploymentArea, attackerPosition, base.GlobalPositionningService); Color color2 = new Color(1f, 0f, 0f, this.defenderAlphaValue); if (this.battleTarget is Garrison) { Garrison garrison = this.battleTarget as Garrison; if (garrison.Empire != null) { color2 = garrison.Empire.Color; Army army = garrison as Army; if (army != null && army.IsPrivateers) { IPlayerControllerRepositoryService service = Services.GetService <IGameService>().Game.Services.GetService <IPlayerControllerRepositoryService>(); if (service.ActivePlayerController != null && service.ActivePlayerController.Empire != null && service.ActivePlayerController.Empire.Index != garrison.Empire.Index) { color2 = global::Game.PrivateersColor; } } color2.a = this.defenderAlphaValue; } } else if (this.battleTarget is District) { color2 = ((District)this.battleTarget).Empire.Color; } component3.SetColor(color2); component3.SetMaterialSelectionStatus(false, true, true); } this.battleZoneGameObject.SetActive(true); this.battleZoneVisible = true; }