private void InitializeFSM() { // Create Minion FSM. fsm = new FSM <States>(); IdleState <States> idleState = new IdleState <States>(fsm, this); SearchState <States> searchState = new SearchState <States>(fsm, this); FlockState <States> flockState = new FlockState <States>(fsm, this, _flockingEntity); PursuitState <States> pursuitState = new PursuitState <States>(fsm, this); FleeState <States> fleeState = new FleeState <States>(fsm, this); // [EVERYONE] Idle Transitions. idleState.AddTransition(States.FLOCKING, flockState); idleState.AddTransition(States.SEARCHING, searchState); idleState.AddTransition(States.PURSUIT, pursuitState); pursuitState.AddTransition(States.FLEE, fleeState); pursuitState.AddTransition(States.FLOCKING, flockState); pursuitState.AddTransition(States.IDLE, idleState); fleeState.AddTransition(States.IDLE, idleState); fleeState.AddTransition(States.PURSUIT, pursuitState); // [BOSS] Search Transitions. searchState.AddTransition(States.IDLE, idleState); searchState.AddTransition(States.PURSUIT, pursuitState); // [MINIONS] Flocking Transitions. flockState.AddTransition(States.IDLE, idleState); flockState.AddTransition(States.PURSUIT, pursuitState); fsm.SetInitState(idleState); }