private void Initialise() { fsm = new FSM(this); // Create the states IdleState idle = new IdleState(); FleeState flee = new FleeState(); ChaseState chase = new ChaseState(); // Create the transitions between the states idle.AddTransition(new Transition(flee, () => TaggerSeen)); flee.AddTransition(new Transition(idle, () => !TaggerSeen)); idle.AddTransition(new Transition(chase, () => isTagged)); flee.AddTransition(new Transition(chase, () => isTagged)); chase.AddTransition(new Transition(idle, () => !isTagged)); // Add the created states to the FSM fsm.AddState(idle); fsm.AddState(flee); fsm.AddState(chase); // Set the starting state of the FSM fsm.Initialise("Idle"); }