public void UpdateMap(Map map)
 {
     foreach (Tile tile in map.TileMap)
     {
         if (tile.Type == TypesOfGroundTiles.RedEnemyTile ||
             tile.Type == TypesOfGroundTiles.BlueEnemyTile ||
             tile.Type == TypesOfGroundTiles.GreenEnemyTile)
         {
             EnemyTile newEnemyTile = tile as EnemyTile;
             if (newEnemyTile.IsDefeated)
             {
                 new TileImage(
                     new Sprite(
                         tile.TileRectangle,
                UIInitializer.CreateGrassTile(this.content))).Draw(this.spriteBatch);
             }
         }
     }
 }
Example #2
0
 public static Map LoadPoisonMap(ContentManager content)
 {
     Map theMap = new Map();
     StreamReader reader = new StreamReader("PoisonMap.txt");
     theMap.LoadContent(reader);
     return theMap;
 }
        public void DrawMap(Map map)
        {
            this.spriteBatch = EntryPoint.Game.SpriteBatch;

            foreach (Tile tile in map.TileMap)
            {
                if (tile.Type == TypesOfGroundTiles.Grass)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreateGrassTile(this.content))).Draw(this.spriteBatch);
                }
                else if (tile.Type == TypesOfGroundTiles.Rock)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreateRockTile(this.content))).Draw(this.spriteBatch);
                }
                else if (tile.Type == TypesOfGroundTiles.Path)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreatePathTile(this.content))).Draw(this.spriteBatch);
                }
                else if (tile.Type == TypesOfGroundTiles.GoToBlue)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreateGoToBlueTile(this.content))).Draw(this.spriteBatch);
                }
                else if (tile.Type == TypesOfGroundTiles.GoToGreen)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreateGoToGreenTile(this.content))).Draw(this.spriteBatch);
                }
                else if (tile.Type == TypesOfGroundTiles.GoToRed)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreateGoToRedTile(this.content))).Draw(this.spriteBatch);
                }
                else if (tile.Type == TypesOfGroundTiles.RedEnemyTile)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreateRedEnemy(this.content))).Draw(this.spriteBatch);
                }
                else if (tile.Type == TypesOfGroundTiles.GreenEnemyTile)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreateGreenEnemy(this.content))).Draw(this.spriteBatch);
                }
                else if (tile.Type == TypesOfGroundTiles.BlueEnemyTile)
                {
                    new TileImage(
                        new Sprite(
                            tile.TileRectangle,
                        UIInitializer.CreateBlueEnemy(this.content))).Draw(this.spriteBatch);
                }
            }
        }