public void DiveIn(float top)
 {
     Dive = true;
     Top  = top;
     ChangeToIdle();
     MarioState.LockOrUnlock(true);
     Parameters.HasGravity = false;
     Parameters.SetVelocity(0, 1);
     AutomaticallyMoving = true;
 }
 public void DiveInRight(float leftSide, float bottom)
 {
     DiveRight = true;
     Top       = leftSide;
     ChangeToWalk();
     MarioState.LockOrUnlock(true);
     Parameters.SetVelocity(1, 0);
     Parameters.HasGravity = false;
     if (Parameters.Position.Y >= bottom)
     {
         Parameters.SetPosition(Parameters.Position.X, bottom - 1);
     }
 }
 private void DivingAndShooting()
 {
     if (Dive && (Parameters.Position.Y - GetHeightAndWidth.X >= Top))
     {
         Dive = false; Sprint5Main.Game.Scene.ByPassMario(); Sprint5Main.Game.LevelControl.SceneFlash(false, false, 0);
     }
     else if (DiveRight && (Parameters.Position.X >= Top))
     {
         DiveRight = false; Sprint5Main.Game.LevelControl.GoToNormalArea();
     }
     if (Shoot && Parameters.Position.Y < Top)
     {
         Shoot = false;
         MarioState.LockOrUnlock(false);
         Parameters.HasGravity = true;
     }
 }
        private float Clock;    // The Clock used for Died Animation

        public Mario(Texture2D[][] marioSpriteSheets, Vector2 location)
        {
            MarioState = new MarioState(this);
            //initialize position and velocity, where the MoveParameter itself will not do.
            Parameters = new MoveParameters(true);
            Parameters.SetPosition(location.X, location.Y);
            Parameters.SetVelocity(0, 0);
            JumpHigher = false; Dive = false; AutomaticallyMoving = false; Shoot = false; DiveRight = false;
            //store 13 Mario textures
            MarioSpriteSheets = marioSpriteSheets ?? throw new ArgumentNullException(nameof(marioSpriteSheets));
            ActionSprites     = new ISprite[6] {
                new AnimatedSprite(MarioSpriteSheets[0][0], new Point(1, 1), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][1], new Point(1, 1), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][2], new Point(1, 3), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][3], new Point(1, 1), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][1], new Point(1, 1), Parameters),
                new AnimatedSprite(MarioSpriteSheets[0][5], new Point(1, 1), Parameters)
            };
            FlagSprite    = new AnimatedSprite(MarioSpriteSheets[0][4], new Point(1, 1), Parameters);
            CurrentSprite = ActionSprites[0];
            Clock         = 0;
        }
 //only change action sprites and action states because they always change together
 public void ChangeActionAndSprite(int changeNumber)
 {
     CurrentSprite = ActionSprites[changeNumber]; // change sprite in mario.
     MarioState.ChangeAction(changeNumber);       // change action state in mario state.
 }
 public void ChangeToWin()
 {
     CurrentSprite = FlagSprite;
     MarioState.LockOrUnlock(true);
 }
 public void Destroy(MarioState marioState)
 {
 }
 public void Destroy(MarioState marioState)
 {
     marioState.ChangeToStandard();
 }
 public void Destroy(MarioState marioState)
 {
     marioState.ChangeToDied();
 }