Finite State Machine Helper  1.0
Public Member Functions | Protected Member Functions | List of all members
FSMHelper.BaseFSMState Class Reference

Base class for a state When making states for your statemachine, you need to inherit this class. Please do not maintain unnessary references to states in your gameplay code, allow the statemachine framework to manage the states. More...

Inheritance diagram for FSMHelper.BaseFSMState:
FSMHelper.FSMStateInterface

Public Member Functions

 BaseFSMState ()
 Default constructor for the state. In your inherited class, you can create constructors with different parameters to represent entry points. Calling a transition to that state with arguments will use the constructor matching those arguments More...
 
virtual void SetupDefinition (ref FSMStateType stateType, ref List< System.Type > children)
 Sets up the structure of the state. Determines if it has children, and if the state is an OR vs AND state. More...
 
virtual void Enter ()
 Enter() is called when the statemachine enters this state More...
 
virtual void Update ()
 Update() is called if this state is active when the statemachine updates More...
 
virtual void Exit ()
 Exit() is called when the statemachine exits this stage More...
 
virtual void ReceiveMessage (object[] args)
 ReceiveMessage will be called when a message is broadcasted to the statemachine while this state is active More...
 
void _InternalSetOwnerLogic (FSMStateMachineLogic ownerLogic)
 Internal system function, do not call this from your gameplay code! More...
 
bool DoTransition (System.Type nextState, object[] args=null)
 You can call DoTransition to transition your state to another state 'nextState' should be a sibling state of the current state, ie in the statemachine definition, the nextState and this state are children of the same parent. More...
 
BaseFSMState GetParentState ()
 Gets the parent state that this state is a child of. More...
 
FSMStateMachine GetStateMachine ()
 Gets the statemachine that this state belongs to. More...
 

Protected Member Functions

void BroadcastMessage (object[] args)
 This function can be used to broadcast a message to all active states in the statemachine. ReceiveMessage(..) will be called on all active states with the specified arguments. More...
 

Detailed Description

Base class for a state When making states for your statemachine, you need to inherit this class. Please do not maintain unnessary references to states in your gameplay code, allow the statemachine framework to manage the states.

Constructor & Destructor Documentation

FSMHelper.BaseFSMState.BaseFSMState ( )

Default constructor for the state. In your inherited class, you can create constructors with different parameters to represent entry points. Calling a transition to that state with arguments will use the constructor matching those arguments

Member Function Documentation

void FSMHelper.BaseFSMState._InternalSetOwnerLogic ( FSMStateMachineLogic  ownerLogic)

Internal system function, do not call this from your gameplay code!

void FSMHelper.BaseFSMState.BroadcastMessage ( object[]  args)
protected

This function can be used to broadcast a message to all active states in the statemachine. ReceiveMessage(..) will be called on all active states with the specified arguments.

Parameters
argsThe arguments to send in the message.
bool FSMHelper.BaseFSMState.DoTransition ( System.Type  nextState,
object[]  args = null 
)

You can call DoTransition to transition your state to another state 'nextState' should be a sibling state of the current state, ie in the statemachine definition, the nextState and this state are children of the same parent.

Parameters
nextStateThe state you need to transition to. This should a sibling of the current state, ie in the statemachine definition, the current state nextState are children of the same parent.
argsThese arguments will be used to choose which constructor of the next state will be called.
Returns
Returns if the transition was successful or not.
virtual void FSMHelper.BaseFSMState.Enter ( )
virtual

Enter() is called when the statemachine enters this state

Implements FSMHelper.FSMStateInterface.

virtual void FSMHelper.BaseFSMState.Exit ( )
virtual

Exit() is called when the statemachine exits this stage

Implements FSMHelper.FSMStateInterface.

BaseFSMState FSMHelper.BaseFSMState.GetParentState ( )

Gets the parent state that this state is a child of.

Returns
Returns the parent state. This will be null at the root of the statemachine.
FSMStateMachine FSMHelper.BaseFSMState.GetStateMachine ( )

Gets the statemachine that this state belongs to.

Returns
Returns the statemachine.
virtual void FSMHelper.BaseFSMState.ReceiveMessage ( object[]  args)
virtual

ReceiveMessage will be called when a message is broadcasted to the statemachine while this state is active

virtual void FSMHelper.BaseFSMState.SetupDefinition ( ref FSMStateType  stateType,
ref List< System.Type >  children 
)
virtual

Sets up the structure of the state. Determines if it has children, and if the state is an OR vs AND state.

Parameters
stateTypeStates of type OR means that only one of its children is active at any one time. Type AND means all its children states are active
childrenThe list of child states for this state. If the state type is OR, the first child in this list will be the initial active state.
virtual void FSMHelper.BaseFSMState.Update ( )
virtual

Update() is called if this state is active when the statemachine updates

Implements FSMHelper.FSMStateInterface.


The documentation for this class was generated from the following file: