using System; namespace net; public class Context { } public class State where T : State where CTX : Context { virtual public void onEnter( CTX ctx, State oldState ) { } virtual public void onExit( CTX ctx, State newState ) { } } /* public class PotentialState : State where T : State where CTX : Context { virtual public void onEnter(CTX ctx, State oldState) { } virtual public void onExit(CTX ctx, State newState) { } } */ public class FSM where T : FSM where CTX : Context where ST : State { public CTX Context { get; private set; } public ST State { get; private set; } public FSM( CTX context, ST state ) { Context = context; State = state; } public void Transition( ST newState ) { } }