com.huguesjohnson.tiamat
Class GameScript

java.lang.Object
  extended by com.huguesjohnson.tiamat.GameScript
All Implemented Interfaces:
Storable

public class GameScript
extends java.lang.Object
implements Storable

GameScript - runs the script for the game, processes events

Author:
Hugues Johnson

Constructor Summary
GameScript()
           
 
Method Summary
 void add(Event event, java.lang.String[] conditions, Event[] returnEvents)
          Add an event to the table.
 void onDeserialize(Formatter formatter, java.lang.String absoluteDir)
          The onDeserialize event should be fired after an object is de-serialized.
 Event[] processEvent(Event event)
          Process an Event triggered by the player.
 Event[] processEvent(Event event, java.lang.String[] conditions)
          Process an Event triggered by the player.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameScript

public GameScript()
Method Detail

processEvent

public Event[] processEvent(Event event)
Process an Event triggered by the player.

Parameters:
event - The Event triggered by the player.
Returns:
A list of Events that were triggered by this initial Event.

processEvent

public Event[] processEvent(Event event,
                            java.lang.String[] conditions)
Process an Event triggered by the player.

Parameters:
event - The Event triggered by the player.
conditions - A list of things that have happened in the game.
Returns:
A list of Event that were triggered by this initial Event.

add

public void add(Event event,
                java.lang.String[] conditions,
                Event[] returnEvents)
Add an event to the table.

Parameters:
event - The event triggering an action.
conditions - Conditions from the game state.
returnEvents - An array of events returned from this initial event.

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