/// <summary> /// This method is going to draw a "diamond" shape overlay. /// </summary> /// <param name="selectedTilePos"></param> /// <param name="range"></param> private static void DrawDiamondOverlay(Vector3Int selectedTilePos, int range) { if (range > 0) { for (int x = 0; x <= range; x++) { for (int y = 0; y <= range - x; y++) { Vector3Int tile = new Vector3Int(selectedTilePos.x + x, selectedTilePos.y + y, 0); if (floorsTilemap.HasTile(tile) && !RangeOverlayTiles.Contains(tile)) { RangeOverlayTiles.Add(tile); } } } for (int x = 0; x <= range; x++) { for (int y = 0; y <= range - x; y++) { Vector3Int tile = new Vector3Int(selectedTilePos.x + x, selectedTilePos.y - y, 0); if (floorsTilemap.HasTile(tile) && !RangeOverlayTiles.Contains(tile)) { RangeOverlayTiles.Add(tile); } } } for (int x = 0; x <= range; x++) { for (int y = 0; y <= range - x; y++) { Vector3Int tile = new Vector3Int(selectedTilePos.x - x, selectedTilePos.y + y, 0); if (floorsTilemap.HasTile(tile) && !RangeOverlayTiles.Contains(tile)) { RangeOverlayTiles.Add(tile); } } } for (int x = 0; x <= range; x++) { for (int y = 0; y <= range - x; y++) { Vector3Int tile = new Vector3Int(selectedTilePos.x - x, selectedTilePos.y - y, 0); if (floorsTilemap.HasTile(tile) && !RangeOverlayTiles.Contains(tile)) { RangeOverlayTiles.Add(tile); } } } } else { Vector3Int tile = new Vector3Int(selectedTilePos.x, selectedTilePos.y, 0); if (floorsTilemap.HasTile(tile)) { RangeOverlayTiles.Add(tile); } } }
/// <summary> /// This method is going to draw a "+" overlay according to a certain range. /// </summary> /// <param name="selectedTilePos"></param> /// <param name="range"></param> private static void DrawCrossOverlay(Vector3Int selectedTilePos, int range) { for (int i = 0; i <= range; i++) { Vector3Int tile = new Vector3Int(selectedTilePos.x + i, selectedTilePos.y, 0); if (!RangeOverlayTiles.Contains(tile)) { if (floorsTilemap.HasTile(tile) && !CheckIfWall(tile) || !floorsTilemap.HasTile(tile) && CheckIfPit(tile) || !floorsTilemap.HasTile(tile) && CheckIfVoid(tile)) { RangeOverlayTiles.Add(tile); } else { break; } } } for (int i = 0; i <= range; i++) { Vector3Int tile = new Vector3Int(selectedTilePos.x, selectedTilePos.y + i, 0); if (!RangeOverlayTiles.Contains(tile)) { if (floorsTilemap.HasTile(tile) && !CheckIfWall(tile) || !floorsTilemap.HasTile(tile) && CheckIfPit(tile) || !floorsTilemap.HasTile(tile) && CheckIfVoid(tile)) { RangeOverlayTiles.Add(tile); } else { break; } } } for (int i = 0; i <= range; i++) { Vector3Int tile = new Vector3Int(selectedTilePos.x - i, selectedTilePos.y, 0); if (!RangeOverlayTiles.Contains(tile)) { if (floorsTilemap.HasTile(tile) && !CheckIfWall(tile) || !floorsTilemap.HasTile(tile) && CheckIfPit(tile) || !floorsTilemap.HasTile(tile) && CheckIfVoid(tile)) { RangeOverlayTiles.Add(tile); } else { break; } } } for (int i = 0; i <= range; i++) { Vector3Int tile = new Vector3Int(selectedTilePos.x, selectedTilePos.y - i, 0); if (!RangeOverlayTiles.Contains(tile)) { if (floorsTilemap.HasTile(tile) && !CheckIfWall(tile) || !floorsTilemap.HasTile(tile) && CheckIfPit(tile) || !floorsTilemap.HasTile(tile) && CheckIfVoid(tile)) { RangeOverlayTiles.Add(tile); } else { break; } } } }