public ITile GenerateNewTile(int x, int y, TileType type) { if (tileArray[x, y] != null) //If theres a tile, activate it's changed event. { tileArray[x, y].RaiseChangedEvent(type); } switch (type) { case TileType.Space: Tiles.Floor.Space space = new Tiles.Floor.Space(x, y, this); return(space); case TileType.Floor: Tiles.Floor.Floor floor = new Tiles.Floor.Floor(x, y, this); return(floor); case TileType.Wall: Tiles.Wall.Wall wall = new Tiles.Wall.Wall(x, y, this); return(wall); default: return(null); } }
private void ParseNameArray() { tileArray = new Tile[mapWidth, mapHeight]; for (int z = 0; z < mapHeight; z++) { for (int x = 0; x < mapWidth; x++) { switch (nameArray[x, z]) { case "wall": case "Wall": tileArray[x, z] = new Tiles.Wall.Wall(x, z, this); break; case "floor": case "Floor": tileArray[x, z] = new Tiles.Floor.Floor(x, z, this); break; case "space": case "Space": tileArray[x, z] = new Tiles.Floor.Space(x, z, this); break; default: break; } } } }
public ITile GenerateNewTile(int x, int y, TileType type) { if (tileArray[x, y] != null) //If theres a tile, activate it's changed event. tileArray[x, y].RaiseChangedEvent(type); switch (type) { case TileType.Space: Tiles.Floor.Space space = new Tiles.Floor.Space(x, y, this); return space; case TileType.Floor: Tiles.Floor.Floor floor = new Tiles.Floor.Floor(x, y, this); return floor; case TileType.Wall: Tiles.Wall.Wall wall = new Tiles.Wall.Wall(x, y, this); return wall; default: return null; } }