de.rico.adventure.structure
Class Chapter

java.lang.Object
  extended by de.rico.adventure.structure.Chapter

public class Chapter
extends java.lang.Object

This class is used for structuring different rooms into a chaper.

Author:
Frank Bruns

Constructor Summary
Chapter()
          Creates a new chapter.
 
Method Summary
 void addConversation(Conversation con)
          Adds the specified conversation object to the chapter.
 void addConversations(java.util.List<Conversation> cons)
          Adds the conversations of the specified list to the chapter.
 void addRoom(Room room)
          Adds a room to the chapter.
 void draw(javax.media.opengl.GL gl)
          Draws the currently active room.
 Room getActiveRoom()
          Returns the currently active room of the chapter.
 Conversation getConversation(java.lang.String id)
          Returns the conversation that corresponds to the specified id.
 java.util.List<Room> getRooms()
          Returns a list of all the rooms of the chapter.
 ScriptInterpreter getScriptInterpreter()
          Returns the script interpreter of this room, if it has been initialized with a script file before.
 void initScripting()
          Initializes scripting for the rooms of this chapter.
 void setActiveRoom(java.lang.String roomId)
          Sets the new active room of the chapter.
 void update(long elapsedTime)
          Updates the currently active room.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Chapter

public Chapter()
Creates a new chapter.

Method Detail

addRoom

public void addRoom(Room room)
Adds a room to the chapter.

Note: The added room will be the new active room. So be careful, if you don't want this room to be the active.

Parameters:
room - room to add to the chapter

getActiveRoom

public Room getActiveRoom()
Returns the currently active room of the chapter.

Returns:
active room of the chapter

setActiveRoom

public void setActiveRoom(java.lang.String roomId)
Sets the new active room of the chapter.

Parameters:
roomId - script id of the room to set active

getRooms

public java.util.List<Room> getRooms()
Returns a list of all the rooms of the chapter.

Returns:
list of rooms

addConversation

public void addConversation(Conversation con)
Adds the specified conversation object to the chapter.

Parameters:
con - conversation object

addConversations

public void addConversations(java.util.List<Conversation> cons)
Adds the conversations of the specified list to the chapter.

Parameters:
cons - list of conversations

getConversation

public Conversation getConversation(java.lang.String id)
Returns the conversation that corresponds to the specified id.

Parameters:
id - id of the conversation to retrieve
Returns:
conversation with the specified id

initScripting

public void initScripting()
Initializes scripting for the rooms of this chapter. Note: Please call this method after every room has been added to the chapter (completely initialized), because you can only access things from within a script file that are part of the chapter's rooms after you call this method.


getScriptInterpreter

public ScriptInterpreter getScriptInterpreter()
Returns the script interpreter of this room, if it has been initialized with a script file before. Otherwise the method will return null.


update

public void update(long elapsedTime)
Updates the currently active room.

Parameters:
elapsedTime - time between two frames.

draw

public void draw(javax.media.opengl.GL gl)
Draws the currently active room.

Parameters:
gl -