public void Next() { if (NextState != null) { State?.OnExit(); Context.NextTick = 0; State = NextState; State.OnEnter(); NextState = null; } NextState = State.Execute(); }
public void Next() { if (Environment.TickCount < Context.NextTick) { return; } Context.NextTick = Environment.TickCount + 200; // Wait 200ms between execution if (NextState != null) { State?.OnExit(); State = NextState; State.OnEnter(); NextState = null; } NextState = State.Execute(); }