コード例 #1
0
        private Tile Create(TileType type)
        {
            Tile newObject = new EmptyTile(0, 0);

            int[] position = new int[2];

            switch (type)
            {
            case TileType.obstacle: randPos(TileType.obstacle, position); newObject = new Obstacle(position[0], position[1]); break;

            case TileType.goblin: randPos(TileType.goblin, position); newObject = new Goblin(position[0], position[1]); break;

            case TileType.hero: randPos(TileType.hero, position); newObject = new Hero(position[0], position[1]); break;

            case TileType.empty_tile: randPos(TileType.empty_tile, position); newObject = new EmptyTile(position[0], position[1]); break;

            case TileType.mage: randPos(TileType.mage, position); newObject = new Mage(position[0], position[1]); break;        // section updated to include mage creation

            case TileType.gold: randPos(TileType.gold, position); newObject = new Gold(position[0], position[1]); break;        // section updated to include gold creation
            }
            return(newObject);
        }