public static void resetHexagonColors(Environment.Map map) { foreach (Environment.Hexagon hex in map.getMapHexagons()) { hex.Color = Color.White; } //colors the room-hexagons in CreateRoom mode, MergeRooms mode, DeleteRoom mode, Build mode, BuildUpgrade mode if (Interaction.GameState == Vars_Func.GameState.CreateRoom || Interaction.GameState == Vars_Func.GameState.MergeRooms || Interaction.GameState == Vars_Func.GameState.DeleteRoom || Interaction.GameState == Vars_Func.GameState.Build || Interaction.GameState == Vars_Func.GameState.BuildUpgrade || Interaction.GameState == Vars_Func.GameState.PlaceAnts || Interaction.GameState == Vars_Func.GameState.PlaceSkeletons || Interaction.GameState == Vars_Func.GameState.PlaceFarm || Interaction.GameState == Vars_Func.GameState.PlaceTemple || Interaction.GameState == Vars_Func.GameState.PlaceEntrance) { foreach (Environment.Hexagon hex in map.getMapHexagons()) { if (hex.RoomNumber == 0) { } else if (hex.RoomNumber % 6 == 0) { hex.Color = Color.Red; } else if (hex.RoomNumber % 6 == 1) { hex.Color = Color.Yellow; } else if (hex.RoomNumber % 6 == 2) { hex.Color = Color.Blue; } else if (hex.RoomNumber % 6 == 3) { hex.Color = Color.Black; } else if (hex.RoomNumber % 6 == 4) { hex.Color = Color.Green; } else if (hex.RoomNumber % 6 == 5) { hex.Color = Color.Purple; } } } //colors the hexagons which are in the mineJobs list else if (Interaction.GameState == Vars_Func.GameState.Mine) { foreach (Vector2 pos in map.MineJobs) { map.getHexagonAt(pos).Color = Color.Purple; } } }
//override public void DrawModel(Renderer.Camera camera, Vector3 drawPosition, Color drawColor) //{ // Matrix modelMatrix = Matrix.Identity * // Matrix.CreateScale(1) * // Matrix.CreateRotationX(0) * // Matrix.CreateRotationY(0) * // Matrix.CreateRotationZ(0) * // Matrix.CreateTranslation(drawPosition); // Vars_Func.getNestModell(typ).Color = drawColor; // Vars_Func.getNestModell(typ).Draw(camera, modelMatrix); //} public void spawnCreature(Environment.Map map, int startage = 0) { Vector2 tmp = map.getHexagonAt(this.position).Neighbors[3]; Queue <Vector2> queue = new Queue <Vector2>(); switch (typ) { case Vars_Func.NestTyp.Entrance: //find free position for the new creature through a broad-first-search queue.Enqueue(tmp); map.getHexagonAt(tmp).Visited = true; while (queue.Count != 0) { tmp = queue.Dequeue(); if (map.getHexagonAt(tmp).Obj == null) { break; } //for all neighbors for (int i = 0; i < 6; ++i) { Vector2 neighbor = map.getHexagonAt(tmp).Neighbors[i]; //which weren't visited already if (map.getHexagonAt(neighbor).Visited == false) { map.getHexagonAt(neighbor).Visited = true; //set visited at true queue.Enqueue(neighbor); //add the neighbor to the queue } } } //set visited for all hexagon at false (for the next use of searching) foreach (Environment.Hexagon hex in map.getMapHexagons()) { if (hex.Visited == true) { hex.Visited = false; } } new Creature(Vars_Func.CreatureTyp.Knight, tmp, this, Vars_Func.ThingTyp.HeroCreature, map, upgradeCount, startage); break; case Vars_Func.NestTyp.Beetle: //find free position for the new creature through a broad-first-search queue.Enqueue(tmp); map.getHexagonAt(tmp).Visited = true; while (queue.Count != 0) { tmp = queue.Dequeue(); if (map.getHexagonAt(tmp).Obj == null) { break; } //for all neighbors for (int i = 0; i < 6; ++i) { Vector2 neighbor = map.getHexagonAt(tmp).Neighbors[i]; //which weren't visited already if (map.getHexagonAt(neighbor).Visited == false) { map.getHexagonAt(neighbor).Visited = true; //set visited at true queue.Enqueue(neighbor); //add the neighbor to the queue } } } //set visited for all hexagon at false (for the next use of searching) foreach (Environment.Hexagon hex in map.getMapHexagons()) { if (hex.Visited == true) { hex.Visited = false; } } new Creature(Vars_Func.CreatureTyp.Beetle, tmp, this, Vars_Func.ThingTyp.DungeonCreature, map, upgradeCount); break; case Vars_Func.NestTyp.Skeleton: //find free position for the new creature through a broad-first-search queue.Enqueue(tmp); map.getHexagonAt(tmp).Visited = true; while (queue.Count != 0) { tmp = queue.Dequeue(); if (map.getHexagonAt(tmp).Obj == null) { break; } //for all neighbors for (int i = 0; i < 6; ++i) { Vector2 neighbor = map.getHexagonAt(tmp).Neighbors[i]; //which weren't visited already if (map.getHexagonAt(neighbor).Visited == false) { map.getHexagonAt(neighbor).Visited = true; //set visited at true queue.Enqueue(neighbor); //add the neighbor to the queue } } } //set visited for all hexagon at false (for the next use of searching) foreach (Environment.Hexagon hex in map.getMapHexagons()) { if (hex.Visited == true) { hex.Visited = false; } } new Creature(Vars_Func.CreatureTyp.Skeleton, tmp, this, Vars_Func.ThingTyp.DungeonCreature, map, upgradeCount); break; } }