public static void RunMachine(bool isMachineMealy, Machine machine) { if (isMachineMealy) { var mealyMachine = new MealyMachine(machine); ShowResult(mealyMachine.Run(mealyMachine.Split(GetString()))); } else { var mooreMachine = new MooreMachine(machine); ShowResult(mooreMachine.Run(mooreMachine.Split(GetString()))); } }
// Start is called before the first frame update void Awake() { Instance = this; sm = MooreMachine <Gamestate, Trigger> .Create(Gamestate.ONGOING) .Configure(Gamestate.ONGOING) .CanTransitionOn(Trigger.Death, Gamestate.LOST) .CanTransitionOn(Trigger.ReachedGoal, Gamestate.WON) .CanTransitionOn(Trigger.FinishedGame, Gamestate.FINAL) .Configure(Gamestate.LOST) .Do(() => { GameObject player = GameObject.Find("Player"); Animator animator = player.GetComponent <Animator>(); animator.SetBool("RUN", false); animator.SetBool("JUMP", false); animator.SetBool("DANCE", false); animator.SetBool("DIE", true); player.GetComponent <Playermovement>().isAlive = false; deathUI.SetActive(true); Invoke("Restart", 4.0f); }) .Configure(Gamestate.WON) .Do(() => { wonUI.SetActive(true); Invoke("StartNextLevel", 2.0f); }) .Configure(Gamestate.FINAL) .Do(() => { wonUI.SetActive(true); Invoke("FinishedGame", 2); }) .Build(); }