public void Initialize() { var p1 = HexagonPosition.Zero; var p2 = new HexagonPosition(0, 1, -1); var p3 = new HexagonPosition(1, 0, -1); HexagonManager.RevealHexagonAt(p1); HexagonManager.RevealHexagonAt(p2); HexagonManager.RevealHexagonAt(p3); StructureManager.CreateStrucuture(new Building(new HexagonNode(p1, p2, p3), this, GameSettings.BuildingDescriptionDatabase.ByNameKey("diamondExtractorName"))); StructureManager.CreateStrucuture(new Building(new HexagonNode(new HexagonPosition(1, 1, -2), p2, p3), this, GameSettings.BuildingDescriptionDatabase.ByNameKey("haborName"))); StructureManager.CreateStrucuture(new Building(new HexagonNode(new HexagonPosition(1, 1, -2), new HexagonPosition(2, 0, -2), p3), this, GameSettings.BuildingDescriptionDatabase.ByNameKey("coalPowerPlantName"))); IsInitialized = true; }
private void StructureAdded(StructureManager manager, Structure structure) { if (ButtonManager[structure.Position] != null) { ButtonManager.RemoveButton(ButtonManager[structure.Position]); } ButtonManager.AddButton(new StructureButton(GameSettings, structure), structure.Position); if (!(structure is Construction)) { foreach (var adjacentHexagonNode in structure.Position.GetAccessibleAdjacentHexagonNodes(HexagonManager)) { var p1 = adjacentHexagonNode.Position1; var p2 = adjacentHexagonNode.Position2; var p3 = adjacentHexagonNode.Position3; if (HexagonManager.GetHexagonAtPosition(p1) == null) { HexagonManager.RevealHexagonAt(p1); } if (HexagonManager.GetHexagonAtPosition(p2) == null) { HexagonManager.RevealHexagonAt(p2); } if (HexagonManager.GetHexagonAtPosition(p3) == null) { HexagonManager.RevealHexagonAt(p3); } if (StructureManager[adjacentHexagonNode] == null && ButtonManager[adjacentHexagonNode] == null) { var button = new BuildButton(GameSettings, adjacentHexagonNode); ButtonManager.AddButton(button, adjacentHexagonNode); } /*if (!EdgeManager.ContainsEdge(structure.Position, adjacentHexagonNode)) * EdgeManager.AddEdge(structure.Position, adjacentHexagonNode);*/ } } }