public void Run() { GQHSMManager manager = GQHSMManager.Instance; // OK, run the state machine for a while. while (true) { manager.Update(); ConsoleKeyInfo input; if (Console.KeyAvailable) { input = Console.ReadKey(true); switch (input.Key) { case System.ConsoleKey.L: { _theHSM.SignalTransition("Lost", null); } break; case System.ConsoleKey.C: { _theHSM.SignalTransition("Loan", null); } break; case System.ConsoleKey.B: { _theHSM.SignalTransition("BoughtByLibrary", "Kenneth L. Hurley"); } break; case System.ConsoleKey.T: { _theHSM.SignalTransition("Late", null); } break; } } } }
public void Run() { GQHSMManager manager = GQHSMManager.Instance; bool bIsInPlayer = false; // OK, run the state machine for a while. while (true) { manager.Update(); ConsoleKeyInfo input; if (Console.KeyAvailable) { input = Console.ReadKey(true); switch (input.Key) { case System.ConsoleKey.L: { _theHSM.SignalTransition("Trigger.Ladder.Enter", null); } break; case System.ConsoleKey.F: { _theHSM.SignalTransition("Trigger.Falling", null); } break; case System.ConsoleKey.G: { _theHSM.SignalTransition("Trigger.OnGround", null); } break; case System.ConsoleKey.H: { _theHSM.SignalTransition("Trigger.FallThroughEnter.Enter", null); } break; case System.ConsoleKey.P: { string st = "Trigger.Player.Enter"; if (bIsInPlayer) { st = "Trigger.Player.Exit"; } bIsInPlayer = !bIsInPlayer; _theHSM.SignalTransition(st, new GameObject("Player")); } break; case System.ConsoleKey.D: { _isBehindDoor = !_isBehindDoor; } break; case System.ConsoleKey.E: { _endOfPath = !_endOfPath; if (_endOfPath) { _theHSM.SignalTransition("EndOfPath", null); } } break; case System.ConsoleKey.T: { _pathToPlayer = !_pathToPlayer; } break; case System.ConsoleKey.V: { _theHSM.SignalTransition("Move.Vertical", null); } break; case System.ConsoleKey.O: { _theHSM.SignalTransition("DoorOpened", null); } break; case System.ConsoleKey.R: { _theHSM.DoTransitionAsync("Idle"); } break; } } } }