C# Class FsmState, nightmare_cooperative

This class represents the States in the Finite State System. Each state has a Dictionary with pairs (transition-state) showing which state the FSM should be if a transition is fired while this state is the current state. Method Reason is used to determine which transition should be fired . Method Act has the code to perform the actions the NPC is supposed do if it's on this state.
显示文件 Open project: jonbro/nightmare_cooperative Class Usage Examples

Protected Properties

Property Type Description
machine FsmSystem,
stateID FsmStateId
transitionMap FsmStateId>.Dictionary

Public Methods

Method Description
AddTransition ( FsmTransitionId trans, FsmStateId id ) : void
DeleteTransition ( FsmTransitionId trans ) : void

This method deletes a pair transition-state from this state's map. If the transition was not inside the state's map, an ERROR message is printed.

DoBeforeEntering ( ) : void

This method is used to set up the State condition before entering it. It is called automatically by the FSMSystem class before assigning it to the current state.

DoBeforeLeaving ( ) : void

This method is used to make anything necessary, as reseting variables before the FSMSystem changes to another one. It is called automatically by the FSMSystem before changing to a new state.

FsmState ( FsmStateId _stateId ) : System
GetOutputState ( FsmTransitionId trans ) : FsmStateId

This method returns the new state the FSM should be if this state receives a transition and

OnGui ( ) : void
PerformTransition ( FsmTransitionId trans ) : void
SetOwner ( FsmSystem, _fsm ) : void
Update ( ) : void

This method is a generic update - just do stuff that this state does per frame

WithBeforeEnteringAction ( Action action ) : FsmState,
WithBeforeLeavingAction ( Action action ) : FsmState,
WithOnGuiAction ( Action action ) : FsmState,
WithTransition ( FsmTransitionId trans, FsmStateId id ) : FsmState,
WithUpdateAction ( Action action ) : FsmState,

Method Details

AddTransition() public method

public AddTransition ( FsmTransitionId trans, FsmStateId id ) : void
trans FsmTransitionId
id FsmStateId
return void

DeleteTransition() public method

This method deletes a pair transition-state from this state's map. If the transition was not inside the state's map, an ERROR message is printed.
public DeleteTransition ( FsmTransitionId trans ) : void
trans FsmTransitionId
return void

DoBeforeEntering() public method

This method is used to set up the State condition before entering it. It is called automatically by the FSMSystem class before assigning it to the current state.
public DoBeforeEntering ( ) : void
return void

DoBeforeLeaving() public method

This method is used to make anything necessary, as reseting variables before the FSMSystem changes to another one. It is called automatically by the FSMSystem before changing to a new state.
public DoBeforeLeaving ( ) : void
return void

FsmState() public method

public FsmState ( FsmStateId _stateId ) : System
_stateId FsmStateId
return System

GetOutputState() public method

This method returns the new state the FSM should be if this state receives a transition and
public GetOutputState ( FsmTransitionId trans ) : FsmStateId
trans FsmTransitionId
return FsmStateId

OnGui() public method

public OnGui ( ) : void
return void

PerformTransition() public method

public PerformTransition ( FsmTransitionId trans ) : void
trans FsmTransitionId
return void

SetOwner() public method

public SetOwner ( FsmSystem, _fsm ) : void
_fsm FsmSystem,
return void

Update() public method

This method is a generic update - just do stuff that this state does per frame
public Update ( ) : void
return void

WithBeforeEnteringAction() public method

public WithBeforeEnteringAction ( Action action ) : FsmState,
action Action
return FsmState,

WithBeforeLeavingAction() public method

public WithBeforeLeavingAction ( Action action ) : FsmState,
action Action
return FsmState,

WithOnGuiAction() public method

public WithOnGuiAction ( Action action ) : FsmState,
action Action
return FsmState,

WithTransition() public method

public WithTransition ( FsmTransitionId trans, FsmStateId id ) : FsmState,
trans FsmTransitionId
id FsmStateId
return FsmState,

WithUpdateAction() public method

public WithUpdateAction ( Action action ) : FsmState,
action Action
return FsmState,

Property Details

machine protected_oe property

protected FsmSystem, machine
return FsmSystem,

stateID protected_oe property

protected FsmStateId stateID
return FsmStateId

transitionMap protected_oe property

protected Dictionary transitionMap
return FsmStateId>.Dictionary