예제 #1
0
        public override void Update(GameTime gameTime)
        {
            if (bombs.Count() > 0)
            {
                for (int i = 0; i < bombs.Count(); i++)
                {
                    if (bombs[i].isTimeForDelete(gameTime))
                    {
                        Bomb bomb = bombs[i];
                        bombs.RemoveAt(i);
                        BombermanGame.getInstance().soundsEffects["bomb"].Play();
                        buildFire(bomb, gameTime);
                        return;
                    }
                }
            }
            if (fires.Count() > 0)
            {
                for (int i = 0; i < fires.Count(); i++)
                {
                    destroySolidBlocks(fires[i].getCurrentPosition());
                    if (fires[i].isTimeForDelete(gameTime))
                    {
                        fires.RemoveAt(i);
                        return;
                    }
                }
            }

            BonusFactory.getInstance().generateBonus(gameTime);
        }
예제 #2
0
 public static BonusFactory getInstance()
 {
     if (bonusFactory == null)
     {
         bonusFactory = new BonusFactory();
     }
     return(bonusFactory);
 }
예제 #3
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            if (!initializedEnviromentSound || gameTime.TotalGameTime.Subtract(tiempo).Seconds > 19)
            {
                MediaPlayer.Play(BombermanGame.getInstance().sounds["enviroment"]);
                tiempo = gameTime.TotalGameTime;
                initializedEnviromentSound = true;
            }

            if (!initializedInvisible)
            {
                buildInvisibleBlocks();
            }
            if (!initializedSolid)
            {
                buildSolidBlocks();
            }

            foreach (Block block in listBlocks)
            {
                block.Draw(gameTime);
            }

            foreach (Bomb bomb in bombs)
            {
                bomb.Draw(gameTime);
            }

            foreach (Fire fire in fires)
            {
                fire.Draw(gameTime);
            }

            foreach (Bonus bonus in bonus)
            {
                bonus.Draw(gameTime);
            }

            BonusFactory.getInstance().generateBonus(gameTime);
        }