com.huguesjohnson.tiamat.demos.Camineet
Class BaseGameState

java.lang.Object
  extended bycom.huguesjohnson.tiamat.demos.Camineet.BaseGameState
All Implemented Interfaces:
Storable
Direct Known Subclasses:
CDGameState

public class BaseGameState
extends java.lang.Object
implements Storable

BaseGameState - base game state

Author:
Hugues Johnson

Constructor Summary
BaseGameState()
          Create an empty BaseGameState.
BaseGameState(Area currentArea)
          Create a BaseGameState with an Area but no conditions.
BaseGameState(Area currentArea, java.lang.String[] conditions)
          Create a BaseGameState with conditions and an Area.
BaseGameState(java.lang.String[] conditions)
          Create a BaseGameState with conditions but no Area.
 
Method Summary
 void addCondition(java.lang.String condition)
          Add a condition (something that has happened in the game).
 java.lang.String[] getConditions()
          Returns all conditions (things that have happened in the game).
 Area getCurrentArea()
          Returns the Area the game is currently in.
 boolean hasCondition(java.lang.String condition)
          Tests if a specific condition has occured.
 void onDeserialize(Formatter formatter, java.lang.String absoluteDir)
          The onDeserialize event should be fired after an object is de-serialized.
 void setCurrentArea(Area currentArea)
          Sets the Area the game is currently in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseGameState

public BaseGameState()
Create an empty BaseGameState.


BaseGameState

public BaseGameState(java.lang.String[] conditions)
Create a BaseGameState with conditions but no Area.

Parameters:
conditions - The initial conditions for this BaseGameState.

BaseGameState

public BaseGameState(Area currentArea)
Create a BaseGameState with an Area but no conditions.

Parameters:
currentArea - The new Area the game is currently in.

BaseGameState

public BaseGameState(Area currentArea,
                     java.lang.String[] conditions)
Create a BaseGameState with conditions and an Area.

Parameters:
currentArea - The new Area the game is currently in.
conditions - The initial conditions for this BaseGameState.
Method Detail

getCurrentArea

public Area getCurrentArea()
Returns the Area the game is currently in.

Returns:
The Area the game is currently in.

setCurrentArea

public void setCurrentArea(Area currentArea)
Sets the Area the game is currently in.

Parameters:
currentArea - The new Area the game is currently in.

addCondition

public void addCondition(java.lang.String condition)
Add a condition (something that has happened in the game).

Parameters:
condition - The condition to add.

getConditions

public java.lang.String[] getConditions()
Returns all conditions (things that have happened in the game).

Returns:
A string array of all conditions (things that have happened in the game).

hasCondition

public boolean hasCondition(java.lang.String condition)
Tests if a specific condition has occured.

Parameters:
condition - The condition to search for.
Returns:
True if the specified condition has occured.

onDeserialize

public void onDeserialize(Formatter formatter,
                          java.lang.String absoluteDir)
The onDeserialize event should be fired after an object is de-serialized. This allows objects to load transient members, set their working directory, and load Storable members if needed.

Specified by:
onDeserialize in interface Storable
Parameters:
formatter - the formatter to use to load any storable members
absoluteDir - the working directory since all paths stored in the object should be relative