FSM logging
This commit is contained in:
parent
1a05f3b2b9
commit
959b9aac05
15
fsm/FSM.cs
15
fsm/FSM.cs
@ -1,6 +1,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
|
||||
@ -41,14 +42,22 @@ public class FSM<T, CTX, ST>
|
||||
State.onEnter( Context, state );
|
||||
}
|
||||
|
||||
public void Transition(ST newState)
|
||||
public void transition(ST newState, string reason = "",
|
||||
[CallerMemberName] string member = "",
|
||||
[CallerFilePath] string path = "",
|
||||
[CallerLineNumber] int line = 0 )
|
||||
{
|
||||
log.debug( $"{GetType().Name} switching to {newState.GetType().Name}from {State.GetType().Name} bcs {reason} Code {log.relativePath(path)}:({line}): {member}" );
|
||||
|
||||
State.onExit( Context, newState );
|
||||
newState.onEnter( Context, State );
|
||||
State = newState;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Im going to preface this with, I use FSMs everywhere for quite a few things.
|
||||
|
||||
*/
|
||||
Loading…
Reference in New Issue
Block a user