A class deriving from this class should be created for every state in the state machine. These classes are where the states have the chance to implement behavior specific to what should happen in that class. See PathEnemyStates for a working example of this.
These functions must be implemented by deriving classes, otherwise you'll get compiler errors.
void Reason (GameObject player, GameObject npc)
This method decides if the state should transition to another on its list.
void Act (GameObject player, GameObject npc)
This method controls the behavior of the NPC in the game world. Every action, movement or communication the NPC does should be placed here.
These functions can be overridden to extend the behavior of this class.
void DoBeforeEntering(GameObject player, GameObject npc)
This method can be used to set up the State before entering it. It is called automatically by the FSMSystem class before assigning it as the current state.
void DoBeforeLeaving(GameObject player, GameObject npc)
This method can be used to reset anything in the state, or perform final actions for the state, before the FSMSystem transitions to a new state. It is called automatically by the FSMSystem before changing to a new state.
void AddTransition(T trans, S id)
This adds a transition to the state. It takes a Transition enum value, and a corresponding StateID enum value. When this state is told to perform the transition specified, it will tell the state machine to go to the state with the StateID specified here.
void DeleteTransition(T trans)
This deletes a given transition.
S GetOutputState(T trans)
This looks up a StateID enum value for a given Transition.
int CompareTo (object other)
This compares one state object to another by comparing the StateID enum values of the states.
void PerformTransition(T trans)
This calls into the state machine to tell it to do the specified transition.
This returns the ID enum value of this state. Read-Only.
stateMachine : FSMSystem <T,S>
This is public so the state machine may set itself in this class when the state is added to the state machine. It is here to provide an easy way to initiate transitions from within the state itself. It shouldn't be changed at runtime.