Exemplo n.º 1
0
        /// <summary>
        /// update game logic
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            background.Update(level.Player.Direction, level.CamType);

            dbox.Update(gameTime);
            if (dbox.IsActive)
            {
                bossCam.Enabled = false;
            }
            else
            {
                bossCam.Enabled = true;
            }

            level.Update(gameTime);
            bossCam.Update();

            SetEyePositions();

            timer += (float)gameTime.ElapsedGameTime.TotalSeconds;

            //launch the projectiles ever 8 seconds
            if (timer >= 8f)
            {
                SoundManager.PlaySound("loudwall", 1f);
                boss.LaunchAllProjectiles();
                timer = 0f;
            }

            //trigger to the next screen when player falls down hole
            if (level.Player.Position.Y > 1000)
            {
                ScreenManager.ChangeScreens(this, new LevelScreen());
            }

            //check if player has died
            if (level.Player.IsDead)
            {
                ScreenManager.ChangeScreens(this, new DeathScreen());
            }


            base.Update(gameTime);
        }
Exemplo n.º 2
0
        /// <summary>
        /// update game logic
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            if (!showTitle)
            {
                enemy.Update(gameTime);
            }

            background.Update(Player.Direction, CamType);

            if (ExitReached && LevelIndex < 2)
            {
                LevelIndex++;
                Reset(indexToLevel(GroupIndex, LevelIndex));
                ExitReached = false;

                LevelData levelData = LevelData.Load();
                levelData.GroupIndex = GroupIndex;
                levelData.LevelIndex = LevelIndex;
                levelData.Save();
            }
            else if (ExitReached && LevelIndex >= 2)
            {
                GroupDone = true;
            }

            shadowCam.Update();

            if (showTitle)
            {
                shadowCam.Enabled = false;
            }
            else
            {
                shadowCam.Enabled = true;
            }


            base.Update(gameTime);
        }