Ejemplo n.º 1
0
        public void Update()
        {
            loader.Update(this);

            if (game.state is SInLevel)
            {
                if (HUD.SONG_INDEX == 0 && HUD.TIME == HotDAMN.TIME_UNTIL_HURRY_UP)
                {
                    HUD.SONG_INDEX++;
                    SoundPanel.PlaySong(songs[HUD.SONG_INDEX], false);
                }
                else if (HUD.SONG_INDEX == 1 && !SoundPanel.IsPlaying())
                {
                    HUD.SONG_INDEX++;
                    SoundPanel.PlaySong(songs[HUD.SONG_INDEX]);
                }
                else if (!SoundPanel.IsPlaying() && HUD.TIME > 0)
                {
                    SoundPanel.PlaySong(songs[HUD.SONG_INDEX]);
                }
            }

            foreach (IBackground s in this.scenery)
            {
                s.Update();
            }
            for (int i = 0; i < particles.Count; i++)
            {
                particles[i].Update();
                if (!particles[i].IsActive)
                {
                    particles.RemoveAt(i);
                    i--;
                }
            }
            for (int count = 0; count < dynamics.Count; count++)
            {
                if (dynamics[count] is IPlayer)
                {
                    ((IPlayer)dynamics[count]).Decorator.Update();
                }
                else
                {
                    if (camera.IsInView(dynamics[count]) || !(dynamics[count] is IEnemy))
                    {
                        dynamics[count].Update();
                    }
                }
            }
            for (int count = 0; count < statics.Count; count++)
            {
                if (statics[count] is IPlayer)
                {
                    ((IPlayer)statics[count]).Decorator.Update();
                }
                else
                {
                    statics[count].Update();
                }
            }

            if (player.Position.X > midpoint * 16)
            {
                HUD.midpointHit[HUD.currentPlayer] = true;
            }

            if (!player.IsActive)
            {
                ResetLevel();
            }

            camera.Update();
            collider.Update();
            player.IsRunning = false;
        }