Beispiel #1
0
    /// <summary>
    /// UpdateDoorTileSetter is a helper method for UpdateDoor that update indiviual tiles
    /// </summary>
    /// <param name="tilePostion">Position of the doorTile regardless of state</param>
    /// <param name="tilemapEnum">Wall tiles need to be added to walls tilemap and the opposite for floor tiles</param>
    /// <param name="tile">Tile</param>
    private void UpdateDoorTileSetter(Vector3Int tilePostion, TilemapEnum tilemapEnum, TileBase tile)
    {
        //Switch to correct tilemap for doors or floors
        switch (tilemapEnum)
        {
        case TilemapEnum.Floors:
            //Remove wall tile
            if (walls.GetTile(tilePostion))
            {
                walls.SetTile(tilePostion, null);
            }
            //Place floor tile
            floors.SetTile(tilePostion, tile);
            break;

        case TilemapEnum.Walls:
            //Remove floor tile
            if (floors.GetTile(tilePostion))
            {
                floors.SetTile(tilePostion, null);
            }
            //Place wall tile
            walls.SetTile(tilePostion, tile);
            break;

        default:
            throw new NotImplementedException();
        }
        tilemapFog.SetTile(tilePostion, darkFog);
    }
Beispiel #2
0
 public DoorTile(Vector3Int doorTilePostion, TilemapEnum openTileTilemap, TileBase openTile, TilemapEnum closedTileTilemap, TileBase closedTile)
 {
     DoorTilePostion   = doorTilePostion;
     OpenTileTilemap   = openTileTilemap;
     OpenTile          = openTile;
     ClosedTileTilemap = closedTileTilemap;
     ClosedTile        = closedTile;
 }
Beispiel #3
0
    /// <summary>
    /// BuildDoorTile, each doorTile will have two states open and closed
    /// </summary>
    /// <param name="tilePosition">Position of the doorTile</param>
    /// <param name="OpenDoorTileTilemap">Tilemap the </param>
    /// <param name="doorClosedTile">Tile the doorTile must used when it is closed, the open tile is assumed to be what the doorTile already is</param>
    /// <returns>Door Tile</returns>
    private DoorTile BuildDoorTile(Vector3Int tilePosition, TilemapEnum OpenDoorTileTilemap, TileBase doorClosedTile)
    {
        switch (OpenDoorTileTilemap)
        {
        case TilemapEnum.Floors:
            return(new DoorTile(tilePosition, TilemapEnum.Floors, floors.GetTile(tilePosition), TilemapEnum.Walls, doorClosedTile));

        case TilemapEnum.Walls:
            return(new DoorTile(tilePosition, TilemapEnum.Walls, walls.GetTile(tilePosition), TilemapEnum.Walls, doorClosedTile));

        default:
            throw new System.NotImplementedException();
        }
        ;
    }