|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.rico.adventure.actions.ActionScheduler
public class ActionScheduler
This is a very important class in the adventure framework. It is used to
process game actions sequencially and makes use of the singleton design
pattern.
Note: Don't forget to call the update() and draw()
methods of the singleton instance in the game's main update()
and draw() methods.
Field Summary | |
---|---|
java.util.concurrent.ConcurrentLinkedQueue<AbstractConcurrentAction> |
queueConcurrent
This list is for concurrent game actions only. |
Method Summary | |
---|---|
void |
add(AbstractAction action)
Adds a game action to the queue of game actions. |
void |
add(AbstractConcurrentAction action,
ScriptInterpreter i)
Adds a game action to the concurrent queue of game actions. |
void |
clear()
Removes every game action from the queue of game actions |
void |
draw(javax.media.opengl.GL gl)
Draws the currently active game action. |
AbstractAction |
getFirst()
Returns first element of the game action queue without removing it. |
java.util.LinkedList<AbstractAction> |
getGameActions()
Returns the list of with the actions of the game actions queue. |
static ActionScheduler |
getInstance()
Returns the singleton instance of the action scheduler. |
java.util.LinkedList<AbstractAction> |
getQueue()
Returns the queue object that is used for the game actions queue. |
AbstractAction |
poll()
Returns the first element of the queue and removes it at the same time from the queue. |
void |
removeConcurrentAction(AbstractConcurrentAction action)
Removes the specified concurrent action from the concurrent game action queue. |
void |
removeFirst()
Removes first element in the game action queue. |
void |
update(long elapsedTime)
Updates the game action that is currently on top of the queue. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.util.concurrent.ConcurrentLinkedQueue<AbstractConcurrentAction> queueConcurrent
public
to circumvent some trouble with scripting.
Method Detail |
---|
public static ActionScheduler getInstance()
public java.util.LinkedList<AbstractAction> getQueue()
public void add(AbstractAction action)
action
- game action to add to the game action queuepublic void add(AbstractConcurrentAction action, ScriptInterpreter i)
action
- game action to add to the concurrent game action queuei
- reference to the script interpreter of the current roompublic void clear()
public void removeFirst()
public void removeConcurrentAction(AbstractConcurrentAction action)
public AbstractAction getFirst()
null
if the queue is empty.
public AbstractAction poll()
public java.util.LinkedList<AbstractAction> getGameActions()
public void update(long elapsedTime)
elapsedTime
- time between two framespublic void draw(javax.media.opengl.GL gl)
gl
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |