C# Class Sharplike.Core.ControlFlow.StateMachine

显示文件 Open project: eropple/sharplike Class Usage Examples

Public Methods

Method Description
CreateStack ( String stackName, AbstractState rootState ) : void

Creates a new stack within the StateMachine.

DestroyStack ( String stackName ) : void

Destroys any non-main, currently inactive stack.

GameLoopTick ( Sharplike loop ) : System.Boolean
PopState ( ) : AbstractState

Pops a state off of the currently active stack. Control flow will return to the next most recent state in the stack, or will terminate execution of the game the last state in the main stack is popped.

PopState ( String stackName ) : AbstractState

Pops a state off of any specified stack. Execution of the game will terminate if the last state is popped from the main stack, and an exception will be thrown if the last state in any other stack is popped.

PushState ( AbstractState newState ) : void

Pushes a state onto the currently active stack (making it the new running state).

PushState ( String stackName, AbstractState newState ) : void

Pushes a state onto the specified stack.

StateMachine ( AbstractState rootState ) : System

Constructor.

SwitchStack ( String stackName ) : void

Switches execution of the state machine to the specified stack.

Private Methods

Method Description
GameProcessing ( object sender, EventArgs e ) : void
InputSystem_CommandEnded ( object sender, Input e ) : void
InputSystem_CommandStarted ( object sender, Input e ) : void
InputSystem_CommandTriggered ( object sender, Input e ) : void

Method Details

CreateStack() public method

Creates a new stack within the StateMachine.
public CreateStack ( String stackName, AbstractState rootState ) : void
stackName String The string key for the new stack.
rootState AbstractState The start state for the new stack.
return void

DestroyStack() public method

Destroys any non-main, currently inactive stack.
public DestroyStack ( String stackName ) : void
stackName String The string key of the stack to destroy.
return void

GameLoopTick() public method

public GameLoopTick ( Sharplike loop ) : System.Boolean
loop Sharplike
return System.Boolean

PopState() public method

Pops a state off of the currently active stack. Control flow will return to the next most recent state in the stack, or will terminate execution of the game the last state in the main stack is popped.
public PopState ( ) : AbstractState
return AbstractState

PopState() public method

Pops a state off of any specified stack. Execution of the game will terminate if the last state is popped from the main stack, and an exception will be thrown if the last state in any other stack is popped.
public PopState ( String stackName ) : AbstractState
stackName String The stack from which to pop a state.
return AbstractState

PushState() public method

Pushes a state onto the currently active stack (making it the new running state).
public PushState ( AbstractState newState ) : void
newState AbstractState The state to add to the currently active stack.
return void

PushState() public method

Pushes a state onto the specified stack.
public PushState ( String stackName, AbstractState newState ) : void
stackName String The stack on which to place the state.
newState AbstractState The state to add to the specified stack.
return void

StateMachine() public method

Constructor.
public StateMachine ( AbstractState rootState ) : System
rootState AbstractState The root state to start the StateMachine on.
return System

SwitchStack() public method

Switches execution of the state machine to the specified stack.
public SwitchStack ( String stackName ) : void
stackName String The string key of the stack to which the state machine shall switch execution.
return void