コード例 #1
0
        private void LoadMap()
        {
            //Convert the map into a game map
            this.GameTiles = new Hashtable();

            foreach (MapTile mapTile in _map.Tiles)
            {
                GameTile gameTile = new GameTile(this, mapTile.Location);
                foreach (string wallImage in mapTile.WallImages)
                {
                    //TODO:Refactor - For now, walls are only on the south and east side
                    //The name of the image determines where it is - horz = south, vert = east
                    if (wallImage.Contains("Horz"))
                    {
                        GameTileWall gameWall = new GameTileWall(gameTile);
                        gameWall.ImageName = wallImage;
                        gameTile.Walls.Add(GameTileWall.WallTilePositions.South, gameWall);
                    }
                    else if (wallImage.Contains("Vert"))
                    {
                        GameTileWall gameWall = new GameTileWall(gameTile);
                        gameWall.ImageName = wallImage;
                        gameTile.Walls.Add(GameTileWall.WallTilePositions.East, gameWall);
                    }
                }

                foreach (string objectImage in mapTile.Objects)
                {
                    GameTileObject gameTileObject = new GameTileObject();
                    gameTileObject.Passable  = true;
                    gameTileObject.ImageName = objectImage;
                }

                foreach (string unpassableObjectImage in mapTile.UnpassableObjects)
                {
                    GameTileObject gameTileObject = new GameTileObject();
                    gameTileObject.Passable  = false;
                    gameTileObject.ImageName = unpassableObjectImage;
                }

                this.GameTiles.Add(mapTile.Location, gameTile);
            }
        }
コード例 #2
0
 public GameTileWall(GameTile gameTile)
 {
     _gameTile = gameTile;
 }