C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
machine FsmSystem,
stateID FsmStateId
transitionMap FsmStateId>.Dictionary

Открытые методы

Метод Описание
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,

Описание методов

AddTransition() публичный Метод

public AddTransition ( FsmTransitionId trans, FsmStateId id ) : void
trans FsmTransitionId
id FsmStateId
Результат void

DeleteTransition() публичный Метод

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
Результат void

DoBeforeEntering() публичный Метод

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
Результат void

DoBeforeLeaving() публичный Метод

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
Результат void

FsmState() публичный Метод

public FsmState ( FsmStateId _stateId ) : System
_stateId FsmStateId
Результат System

GetOutputState() публичный Метод

This method returns the new state the FSM should be if this state receives a transition and
public GetOutputState ( FsmTransitionId trans ) : FsmStateId
trans FsmTransitionId
Результат FsmStateId

OnGui() публичный Метод

public OnGui ( ) : void
Результат void

PerformTransition() публичный Метод

public PerformTransition ( FsmTransitionId trans ) : void
trans FsmTransitionId
Результат void

SetOwner() публичный Метод

public SetOwner ( FsmSystem, _fsm ) : void
_fsm FsmSystem,
Результат void

Update() публичный Метод

This method is a generic update - just do stuff that this state does per frame
public Update ( ) : void
Результат void

WithBeforeEnteringAction() публичный Метод

public WithBeforeEnteringAction ( Action action ) : FsmState,
action Action
Результат FsmState,

WithBeforeLeavingAction() публичный Метод

public WithBeforeLeavingAction ( Action action ) : FsmState,
action Action
Результат FsmState,

WithOnGuiAction() публичный Метод

public WithOnGuiAction ( Action action ) : FsmState,
action Action
Результат FsmState,

WithTransition() публичный Метод

public WithTransition ( FsmTransitionId trans, FsmStateId id ) : FsmState,
trans FsmTransitionId
id FsmStateId
Результат FsmState,

WithUpdateAction() публичный Метод

public WithUpdateAction ( Action action ) : FsmState,
action Action
Результат FsmState,

Описание свойств

machine защищенное свойство

protected FsmSystem, machine
Результат FsmSystem,

stateID защищенное свойство

protected FsmStateId stateID
Результат FsmStateId

transitionMap защищенное свойство

protected Dictionary transitionMap
Результат FsmStateId>.Dictionary