Game Development Reference
In-Depth Information
case PlayerStateController.playerStates.idle:
break;
case PlayerStateController.playerStates.left:
break;
case PlayerStateController.playerStates.right:
break;
case PlayerStateController.playerStates.jump:
float nextAllowedJumpTime = PlayerStateController.stateDelayTimer[
(int)PlayerStateController.playerStates.jump ];
if(nextAllowedJumpTime == 0.0f || nextAllowedJumpTime > Time.time)
returnVal = true;
break;
case PlayerStateController.playerStates.landing:
break;
case PlayerStateController.playerStates.falling:
break;
case PlayerStateController.playerStates.kill:
break;
case PlayerStateController.playerStates.resurrect:
break;
}
// Value of true means 'Abort'. Value of false means 'Continue'.
return returnVal;
}
Now, we just need to call the checkIfAbortOnStateCondition method when we
do our state change. In onStateChange , just after the newState == currentState
check, add the following code snippet:
//Verify there are no special conditions that would cause this
//state to abort
if(checkIfAbortOnStateCondition(newState))
return;
 
Search WWH ::




Custom Search