コード例 #1
0
 public SCastleComplete(Game1 game, SInLevel state)
 {
     SoundPanel.PlaySong(Sound.castleComplete, false);
     this.counter = 0;
     this.Game    = game;
     this.state   = state;
     Game.state   = this;
 }
コード例 #2
0
ファイル: StarPlayer.cs プロジェクト: mmcgaha/SuperMarioBros
        public StarPlayer(IPlayer player)
            : base(player)
        {
            this.player    = player;
            this.starFrame = 0;
            this.decoratedPlayer.CollisionHandler = new InvinciblePlayerCollisionHandler(this.decoratedPlayer);
            this.timer = 0;

            SoundPanel.PlaySong(HUD.TIME < HotDAMN.TIME_UNTIL_HURRY_UP ? Sound.hurrystarmanTheme : Sound.starmanTheme);
        }
コード例 #3
0
        public SGameOver(Game1 game)
        {
            Game         = game;
            Game.state   = this;
            HUD.TIME     = 0;
            this.counter = 0;
            HUD.LIVES[HUD.currentPlayer]    = HotDAMN.INITIAL_LIVES_COUNT;
            HUD.worldNum[HUD.currentPlayer] = 1;
            HUD.levelNum[HUD.currentPlayer] = 1;

            SoundPanel.PlaySong(Sound.gameover1Theme, false);
            controllers = new List <IController>();
            controllers.Add(new KeyboardCommands(Game));
        }
コード例 #4
0
        public SDeadMario(IPlayer player, bool showMario = true)
        {
            this.showMario = showMario;
            this.Player    = player;
            this.counter   = 0;
            Player.Sprite  = new MarioAnimation(HUD.currentPlayer == 0 ? Textures.mario0 : Textures.luigi0, Textures.smallDead);

            Player.Hitbox.Clear();
            SetHitbox();

            Player.Velocity     = Vector2.Zero;
            Player.Acceleration = Vector2.Zero;
            SoundPanel.PlaySong(Sound.deadTheme, false);
            HUD.LIVES[HUD.currentPlayer]--;
            HUD.MARIO_STATE[HUD.currentPlayer]        = null;
            HUD.firstLevelEntrance[HUD.currentPlayer] = false;
            HUD.nextPlayer++;
        }
コード例 #5
0
        public void Update()
        {
            counter++;
            state.Update();

            if (counter == HotDAMN.TICKS_UNTIL_LEVEL_COMPELTE_FANFARE)
            {
                SoundPanel.PlaySong(Sound.levelcompleteTheme, false);
            }
            if (counter >= HotDAMN.TICKS_UNTIL_LEVEL_TIMER_TALLIES && HUD.TIME > 0)
            {
                HUD.TIME--;
                HUD.SCORE[HUD.currentPlayer] += 50;
                SoundPanel.PlaySoundEffect(Sound.scoreEffect);
            }
            if (HUD.TIME == 0)
            {
                HUD.TIME = -1;
                counter  = 1000000;
            }
            if (HUD.TIME == -1 && (fireworks > 0 && counter % 35 == 0))
            {
                HUD.level.AddParticle(new Fireworks(fireworkPos[fireworkCounter]));
                fireworkCounter++;
                fireworks--;
            }
            if (counter >= 1000000 + (fireworks + 2) * HotDAMN.TICKS_UNTIL_NEXT_FIREWORK)
            {
                if (HUD.level.player.AutoMove != null)
                {
                    HUD.level.player.AutoMove.IsActive = false;
                }
                HUD.MARIO_STATE[HUD.currentPlayer]        = (IPlayerState)state.Level.player.State;
                HUD.firstLevelEntrance[HUD.currentPlayer] = true;
                HUD.midpointHit[HUD.currentPlayer]        = false;
                HUD.NextLevel();
                Game.state = new SLevelIntro(Game, HUD.worldNum[HUD.currentPlayer] + "-" + HUD.levelNum[HUD.currentPlayer]);
            }
        }
コード例 #6
0
        public void InitializeObjects()
        {
            Size = loader.Reset();

            fireballCount = 0;

            this.songs = new List <Song>();
            dynamics   = new List <ITangible>();
            statics    = new List <ITangible>();
            scenery    = new List <IBackground>();
            particles  = new List <IParticle>();
            collider   = new Collider(this);
            camera     = new Camera1(this, HotDAMN.CAMERA_OFFSET_X, HotDAMN.CAMERA_OFFSET_Y, HotDAMN.WINDOW_WIDTH, HotDAMN.WINDOW_HEIGHT);
            HUD.level  = this;

            camXNow  = camera.Viewport.Right / HotDAMN.GRID;
            camXThen = -HotDAMN.OFFSCREEN_LEVEL_LOAD_BLOCKS;
            loader.SetLevelSettings(this);

            HUD.SONG_INDEX = 0;
            SoundPanel.PlaySong(songs[HUD.SONG_INDEX]);
        }
コード例 #7
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;
        }