Transition from one state to another
One state
// StateA.cs --------------------------
public override bool CheckExitTransition()
{
if( someCondition )
{
// Add StateB to the queue
CharacterStateController.EnqueueTransition<StateB>();
}
}// StateB.cs --------------------------
public override bool CheckEnterTransition( CharacterState fromState )
{
// True if fromState is StateA. False otherwise
if( fromState == CharacterStateController.GetState<StateA>() )
return true;
return false;
}Multiple states
Last updated