Package svs_simulation :: Package ai_lib :: Module statemachine :: Class StateManager
[show private | hide private]
[frames | no frames]

Class StateManager

Known Subclasses:
AgentStateManager

Provides management handlers for parallel state machine.

Based on Sean Riley's example in Game Programming with Python, Charles River Media, 2004.
Method Summary
  __init__(self, agent)
Initialises state manager.
  clearPropertiesForState(self, stateName)
Removes all properties for specified state.
  getCurrentStates(self)
Returns a dictionary representing the current state in each of the state layers.
  getNameForState(self, layerName)
Return the name of the current state for specified layer.
  getState(self, layerName)
Return the current state for specified layer.
  getStateProperty(self, stateName, propertyName)
Returns a property value for a state.
  gotoState(self, newStateName, layerName)
Set specified layer to new state.
  setInitialState(self, stateName, layerName)
Sets initial state for agent.
  setInput(self, input, layerName)
Sends an input event.
  setStateProperty(self, stateName, propertyName, propertyValue)
Stores a property value for a state.

Instance Variable Summary
object agent: agent object to whom state manager applies.
dict currentStates: list of current states.

Class Variable Summary
dict layers: list of layers for parallel state machine.

Method Details

__init__(self, agent)
(Constructor)

Initialises state manager.
Parameters:
agent - agent object to whom state manager applies.
           (type=object)

clearPropertiesForState(self, stateName)

Removes all properties for specified state.
Parameters:
stateName - name of state
           (type=string)

getCurrentStates(self)

Returns a dictionary representing the current state in each of the state layers.

getNameForState(self, layerName)

Return the name of the current state for specified layer.
Parameters:
layerName - name of layer
           (type=string)

getState(self, layerName)

Return the current state for specified layer.
Parameters:
layerName - name of layer
           (type=string)

getStateProperty(self, stateName, propertyName)

Returns a property value for a state.
Parameters:
stateName - name of state
           (type=string)
propertyName - name of property
           (type=string)

gotoState(self, newStateName, layerName)

Set specified layer to new state.
Parameters:
newStateName - name of new state
           (type=string)
layerName - name of layer
           (type=string)

setInitialState(self, stateName, layerName)

Sets initial state for agent.
Parameters:
stateName - name of state
           (type=string)
layerName - name of layer that state belongs to
           (type=string)

setInput(self, input, layerName=None)

Sends an input event. Can be sent directly to a specified layer. If layer is not specified, seraches for appropriate layer.
Parameters:
input - input to respond to
           (type=object)
layerName - name of layer
           (type=string)

setStateProperty(self, stateName, propertyName, propertyValue)

Stores a property value for a state.
Parameters:
stateName - name of state
           (type=string)
propertyName - name of property
           (type=string)
propertyValue - value of property
           (type=object)

Instance Variable Details

agent

agent object to whom state manager applies.
Type:
object

currentStates

list of current states.
Type:
dict

Class Variable Details

layers

list of layers for parallel state machine.
Type:
dict

Generated by Epydoc 2.1 on Thu Oct 20 15:30:25 2005 http://epydoc.sf.net