Jump to content

Recommended Posts

Mainly targeted @Droidz but if anyone else has input, you're welcome to contribute.

The state interface has BeforeStates and NextStates. My question is when do they run and does their "Need To Run" condition get checked?

If you add the state into the list of before or after states are they in the main engine list of states or are they only considered if the state you added the before/afterstates to, is triggered?

Hello, like that (in simplified):

bool RunState(State currentState)
{
	if (currentState.NeedToRun)
	{
		foreach (var beforeState in currentState.BeforeStates)
		{
			RunState(beforeState);
		}
		
		currentState.Run();
		
		foreach (var nextState in state.NextStates)
		{
			RunState(nextState);
		}
		
		return true;
	}
    return false;
}

 

9 hours ago, Avvi said:

I sort of talked about this in my post: 

Yeah I saw that, very useful. I was more wondering about the actual states interface implementation of Before/NextStates rather than the events though.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...