Example #1
0
 public override void GoRight()
 {
     if (Mario.Facing)//right
     {
         CurrentState.ExitState();
         CurrentState = new Running(Mario);
         CurrentState.Enter(this);
     }
     else//idle was facing left
     {
         Mario.Facing = true;//right
         CurrentState = new Idling(Mario);
         CurrentState.Enter(this);
     }
 }
Example #2
0
 public override void GoLeft()
 {
     if (Mario.Facing)         //right
     {
         Mario.Facing = false; //left
         CurrentState = new Idling(Mario);
         CurrentState.Enter(this);
     }
     else//left
     {
         CurrentState.ExitState();
         CurrentState = new Running(Mario);
         CurrentState.Enter(this);
     }
 }