示例#1
0
 //All the transitions here
 public override void DamageTransition(IMarioPowerupStates previousState)
 {
     CurrentState.ExitState();
     CurrentState = new MarioStandardState(Mario);
     CurrentState.Enter(this);
     Mario.Position = new Vector2(Mario.Position.X, Mario.Position.Y + 24);
 }
示例#2
0
 public override void SuperTransition(IMarioPowerupStates previousState)
 {
     CurrentState.ExitState();
     CurrentState = new MarioSuperState(Mario);
     CurrentState.Enter(this);
     Mario.Position = new Vector2(Mario.Position.X, Mario.Position.Y - 24);
 }
示例#3
0
        public override void Enter(IMarioPowerupStates previousState)
        {
            //Initialize state variables
            Mario.MarioHeightFactor  = 1;
            Mario.DeadPositionFactor = 1;

            //Initialize states
            CurrentState  = this;
            PreviousState = previousState;
        }
示例#4
0
 public IActionState Crouch(/*IPowerupState currentPowerupState*/ IMarioPowerupStates currentPowerupState)
 {
     if (currentPowerupState is MarioStandardState)
     {
         return(this);
     }
     else
     {
         CrouchingState.Instance.PrevState = this;
         return(CrouchingState.Instance);
     }
 }
示例#5
0
 //This transition is only kept for the cheat commands Yy
 public override void StandardTransition(IMarioPowerupStates previousState)
 {
     DamageTransition(this);
 }
示例#6
0
 public override void FireTransition(IMarioPowerupStates previousState)
 {
     CurrentState.ExitState();
     CurrentState = new MarioFireState(Mario);
     CurrentState.Enter(this);
 }
 public virtual void SuperTransition(IMarioPowerupStates previousState)
 {
 }
 public virtual void DamageTransition(IMarioPowerupStates previousState)
 {
 }
 public virtual void Enter(IMarioPowerupStates previousState)
 {
     CurrentState  = this;
     PreviousState = previousState;
 }
 public Texture2D GetSprite(IActionState actionState, IMarioPowerupStates powerUpState, GameTime gameTime)
 {
     if (powerUpState is MarioDeadState)
     {
         //dead :(
         return(this.dead);
     }
     else if (powerUpState is MarioStandardState)
     {
         if (actionState is IdlingState)
         {
             //standard idling
             return(this.standardIdling);
         }
         else if (actionState is JumpingState)
         {
             //standard jumping
             return(this.standardJumping);
         }
         else if (actionState is FallingState)
         {
             //standard falling
             return(this.standardFalling);
         }
         else if (actionState is RunningState)
         {
             //standard running
             //animate
             int  animationIntervalTicks = 2000000;
             long animationFrame         = gameTime.TotalGameTime.Ticks / animationIntervalTicks;
             int  animationIndex         = (int)(animationFrame % standardRunning.Count);
             return(this.standardRunning[animationIndex]);
         }
         else if (actionState is CrouchingState)
         {
             //standard crouching
             return(this.standardCrouching);
         }
     }
     else if (powerUpState is MarioSuperState)
     {
         if (actionState is IdlingState)
         {
             //super idling
             return(this.superIdling);
         }
         else if (actionState is JumpingState)
         {
             //super jumping
             return(this.superJumping);
         }
         else if (actionState is FallingState)
         {
             //super falling
             return(this.superFalling);
         }
         else if (actionState is RunningState)
         {
             //super running
             //animate
             int  animationIntervalTicks = 2000000;
             long animationFrame         = gameTime.TotalGameTime.Ticks / animationIntervalTicks;
             int  animationIndex         = (int)(animationFrame % superRunning.Count);
             return(this.superRunning[animationIndex]);
         }
         else if (actionState is CrouchingState)
         {
             //super crouching
             return(this.superCrouching);
         }
     }
     else if (powerUpState is MarioFireState)
     {
         if (actionState is IdlingState)
         {
             //fire idling
             return(this.fireIdling);
         }
         else if (actionState is JumpingState)
         {
             //fire jumping
             return(this.fireJumping);
         }
         else if (actionState is FallingState)
         {
             //fire falling
             return(this.fireFalling);
         }
         else if (actionState is RunningState)
         {
             //animate
             int  animationIntervalTicks = 2000000;
             long animationFrame         = gameTime.TotalGameTime.Ticks / animationIntervalTicks;
             int  animationIndex         = (int)(animationFrame % fireRunning.Count);
             return(this.fireRunning[animationIndex]);
         }
         else if (actionState is CrouchingState)
         {
             //fire crouching
             return(this.fireCrouching);
         }
     }
     return(null);
 }
示例#11
0
 public IActionState Crouch(/*IPowerupState currentPowerupState*/ IMarioPowerupStates currentPowerupState)
 {
     return(Leave());
 }
示例#12
0
 public IActionState Crouch(/*IPowerupState currentPowerupState*/ IMarioPowerupStates currentPowerupState)
 {
     return(this.prevState);
 }