Access

FeastSC2

New member
Hey,

I have a state machine in my code that's based on classes.
I created a node in BD to go to a state. But right now it's called by string, I have to type in the name of the State.

Is it possible that I can lookup this name automatically in BD? so that I don't have to type every state available to my unit.

Just FYI: I don't have variables like "public State_Fireball FireballState;"
my states are built automatically through reflection.

The component of my state machine is on the same gameObject as my BehaviorTree component.

Here's an example of a state class in my code.
protected class State_Fireball : AI_State<Detonator_AI>
{
protected override void Enter()
{
U.FireballRecharge.Reset();
U.Anim.SetTrigger(Parameters.Attack_T);
}

protected override void Exit()
{
U.Anim.ResetTrigger(Parameters.Attack_T);
}

protected override Type Update()
{
if (U.Fsm.IsExitAnimInState(VIS.attack2))
{
return typeof(State_Idle);
}

return null;
}
}
 
Depending on your state machine you could potentially cache the state within the OnAwake method of the behavior tree task, but this largely depends on your state machine.
 
Top