Ok I understand what you mean now.
Even though I think it is generally not a very good design approach to handle things on exit, based on what the upcomming state would be (maybe Im wrong), it is something easy to add.
Please do the following changes in FSM.cs just to confirm that is indeed what you are after and let me know.
1) Add public FSMState nextState{get; private set;} in the class.
2) In EnterState method and right after the first two checks, add nextState = newState; so that the code looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
///Enter a state providing the state itself
publicboolEnterState(FSMState newState){
if(!isRunning){
Debug.LogWarning("Tried to EnterState on an FSM that was not running",this);
returnfalse;
}
if(newState==null){
Debug.LogWarning("Tried to Enter Null State");
returnfalse;
}
nextState=newState;
//...
//...
Let me know.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Login
Register
By registering on this website you agree to our Privacy Policy.