예제 #1
0
파일: Level.cs 프로젝트: Tritax/EvoBlob
        private bool Compile(bool editor)
        {
            bool start = false, end = false;

             Powerup up = null;
             for (int y = 0; y < _height; y++)
             {
            for (int x = 0; x < _width; x++)
            {
               up = null;
               switch (_tiles[x, y].Flags)
               {
                  default: break;
                  case Tile.FLAG_START_POS:
                     _startPos = new Vector2(x, y);
                     start = true;
                     break;
                  case Tile.FLAG_WIN_POS:
                     up = new Powerup();
                     up.SetPosition(x * Game1.TILE_SIZE, y * Game1.TILE_SIZE);
                     up.SetType(Data.Powerup.WIN_EVOLVE);

                     _winPos = new Vector2(x, y);
                     _powerupList.Add(up);
                     end = true;
                     break;
                  case Tile.FLAG_SPIKEY:
                     Badguy bad = new Badguy();
                     bad.SetPosition(x * Game1.TILE_SIZE, y * Game1.TILE_SIZE);
                     _badGuyList.Add(bad);
                     break;
                  case Tile.FLAG_FROG:
                     up = new Powerup();
                     up.SetPosition(x * Game1.TILE_SIZE, y * Game1.TILE_SIZE);
                     up.SetType(Data.Powerup.FROG_EVOLVE);

                     _powerupList.Add(up);
                     break;
                  case Tile.FLAG_STALAGMITE:
                     up = new Powerup();
                     up.SetPosition(x * Game1.TILE_SIZE, y * Game1.TILE_SIZE);
                     up.SetType(Data.Powerup.ROCK_EVOLVE);

                     _powerupList.Add(up);
                     break;
                  case Tile.FLAG_FISH:
                     up = new Powerup();
                     up.SetPosition(x * Game1.TILE_SIZE, y * Game1.TILE_SIZE);
                     up.SetType(Data.Powerup.FISH_EVOLVE);

                     _powerupList.Add(up);
                     break;
                  case Tile.FLAG_SPIDER:
                     up = new Powerup();
                     up.SetPosition(x * Game1.TILE_SIZE, y * Game1.TILE_SIZE);
                     up.SetType(Data.Powerup.SPIDER_EVOLVE);

                     _powerupList.Add(up);
                     break;
                  case Tile.FLAG_BAT:
                     up = new Powerup();
                     up.SetPosition(x * Game1.TILE_SIZE, y * Game1.TILE_SIZE);
                     up.SetType(Data.Powerup.BAT_EVOLVE);

                     _powerupList.Add(up);
                     break;
               };
            }
             }

             if (!editor)
             {
            if (!start || !end)
               return false;
             }

             return true;
        }
예제 #2
0
파일: Level.cs 프로젝트: Tritax/EvoBlob
 public void RemovePowerup(Powerup up)
 {
     _powerupList.Remove(up);
      Point pt = up.GetTilePos();
      GetAt(pt.X, pt.Y).Flags = 0;
 }