public void Execute() { if (myhandler.mario.State.MarioShape == Shape.Dead || myhandler.mario.IsProtected || !myhandler.enemy.Alive) { return; } int marioPreY = (int)(myhandler.mario.Destination.Y - (myhandler.mario.Velocity.Y - 1)); if (marioPreY + myhandler.mario.Destination.Height < myhandler.enemy.Destination.Y) { ICommand TopCommand = new MarioEnemyTop(myhandler); TopCommand.Execute(); return; } if (myhandler.enemy.Alive) { if (myhandler.mario.State.IsStar) { myhandler.enemy.Terminate("Right"); ScoringSystem.AddPointsForStompingEnemy(myhandler.enemy); SoundManager.Instance.PlayStompSound(); } else { myhandler.enemy.ChangeDirection(); switch (myhandler.mario.State.MarioShape) { case Shape.Small: myhandler.mario.State.Terminated(); break; case Shape.Big: myhandler.mario.IsProtected = true; myhandler.mario.State.MarioShapeChange(Shape.Small); SoundManager.Instance.PlayPipeSound(); break; case Shape.Fire: myhandler.mario.IsProtected = true; myhandler.mario.State.MarioShapeChange(Shape.Small); SoundManager.Instance.PlayPipeSound(); break; } } } }
public void Execute() { if (myhandler.mario.State.MarioShape == Shape.Dead || !myhandler.enemy.Alive) { return; } myhandler.mario.Location = new Vector2(myhandler.mario.Location.X, myhandler.enemy.Location.Y - myhandler.mario.Destination.Height + 1); if (myhandler.enemy.Alive) { myhandler.mario.Velocity = new Vector2(myhandler.mario.Velocity.X, GameData.marioBouncingSpeed); myhandler.enemy.Terminate("Top"); SoundManager.Instance.PlayStompSound(); ScoringSystem.AddPointsForStompingEnemy(myhandler.enemy); } }
public void Execute() { if (myhandler.mario.State.MarioShape == Shape.Dead || !myhandler.enemy.Alive) { return; } myhandler.mario.Location = new Vector2(myhandler.mario.Location.X, myhandler.enemy.Location.Y - myhandler.mario.Destination.Height + 1); if (myhandler.enemy.Alive) { if (!myhandler.mario.IsInWater) { myhandler.mario.Velocity = new Vector2(myhandler.mario.Velocity.X, GameData.marioBouncingSpeed); myhandler.enemy.Terminate("Top"); SoundManager.Instance.PlayStompSound(); ScoringSystem.AddPointsForStompingEnemy(myhandler.enemy); } else { myhandler.enemy.ChangeDirection(); switch (myhandler.mario.State.MarioShape) { case Shape.Small: myhandler.mario.State.Terminated(); break; case Shape.Big: myhandler.mario.IsProtected = true; myhandler.mario.State.MarioShapeChange(Shape.Small); SoundManager.Instance.PlayPipeSound(); break; case Shape.Fire: myhandler.mario.IsProtected = true; myhandler.mario.State.MarioShapeChange(Shape.Small); SoundManager.Instance.PlayPipeSound(); break; } } } }