// Paints fog of war map public void PaintFogMap() { foreach (Vector3Int tileCoords in fogMap.GetVisibleTileCoords()) { tilemap.SetTile(tileCoords, null); } tilemap.RefreshAllTiles(); }
// Create action map public void CreateActionMap(GamePiece piece, GameMap gameMap, FogMap fogOfWarMap) { ClearActionTiles(); if (piece == null) { return; } Vector3Int hexCoords = piece.gameHex.hexCoords; List <Vector3Int> visibleTileCoords = fogOfWarMap.GetVisibleTileCoords(); if (piece.pieceType == PieceType.Unit) { Unit unit = (Unit)piece; int remainingSpeed = unit.remainingSpeed; int range = unit.range; // Get hexes in range of unit movement and set tiles List <GameHex> gameHexes = gameMap.GetHexesInRange(gameMap.hexCoordsDict, hexCoords, remainingSpeed + range); for (int i = 0; i < gameHexes.Count; i++) { GameHex gameHex = gameHexes[i]; Vector3Int tileCoords = Hex.HexToTileCoords(gameHex.hexCoords); int distance = Hex.GetDistanceHexCoords(hexCoords, gameHex.hexCoords); // Set tile to appropriate movement tile type if (!gameHex.HasPiece()) { if (distance <= remainingSpeed) { paintedTiles[tileCoords] = movementTile; } } else { if (gameHex.piece.GetPlayerId() != unit.GetPlayerId() && visibleTileCoords.Contains(tileCoords)) { paintedTiles[tileCoords] = attackTile; } } } } }