Hello, I have initialized my fsm with 2 custom types (AIStateand AIStateEvent) instead of string type.
fsm = new StateMachine<AIState, AIStateEvent>();
I see that there are various useful shortcuts, but I can't find one to create a transition directly between custom types in AddTriggerTransition. So, I have to use:
fsm.AddTriggerTransition(AIStateEvent.PLAYER_DETECTED, new Transition<AIState>(AIState.IDLE, AIState.CHASE));
Am I correct in assuming there isn’t a shortcut like this?
Of course, I could implement my own shortcut, but I’d prefer to use what the library provides rather than adding extra layers. :)
Something like this should work as extension:
public static void AddTriggerTransition<E, S>(this StateMachine<S, E> stateMachine, E trigger, S from, S to)
{
stateMachine.AddTriggerTransition(trigger, new Transition<S>(from, to));
}
Hello, I have initialized my fsm with 2 custom types (
AIState
andAIStateEvent
) instead ofstring
type.I see that there are various useful shortcuts, but I can't find one to create a transition directly between custom types in
AddTriggerTransition
. So, I have to use:Am I correct in assuming there isn’t a shortcut like this?
Of course, I could implement my own shortcut, but I’d prefer to use what the library provides rather than adding extra layers. :)
Something like this should work as extension: