コード例 #1
0
 private void UpdateTiles(Vector2Int pos)
 {
     foreach (Vector2Int occupyingLocation in currentTower.occupyingLocations)
     {
         gridTilemap.SetTile((Vector3Int)(_lastMousePos + occupyingLocation), normalTile);
     }
     foreach (Vector2Int occupyingLocation in currentTower.occupyingLocations)
     {
         Vector2Int target = new Vector2Int(pos.x + occupyingLocation.x, pos.y + occupyingLocation.y);
         if (Grid.GetCell(target).occupied)
         {
             gridTilemap.SetTile((Vector3Int)target, occupiedTile);
         }
         else
         {
             gridTilemap.SetTile((Vector3Int)target, freeTile);
         }
     }
     currentTower.SetGridPosition(pos);
 }