gameaction
Class GameActionScheduler

java.lang.Object
  extended by gameaction.GameActionScheduler
All Implemented Interfaces:
java.io.Serializable

public class GameActionScheduler
extends java.lang.Object
implements java.io.Serializable

This class manages a queue of game actions

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
GameActionScheduler(AbstractCharacterSprite c)
          Creates a new game action scheduler with the specified character as the owner.
 
Method Summary
 void add(AbstractGameAction action)
          Adds a game action to the queue of game actions.
 void clear()
          Removes every game action from the queue of game actions
 boolean containsActionsOtherThanWalk()
          This methods determines whether there a game actions the queue that are other than walk game actions
 AbstractGameAction getFirst()
          Returns first element of the game action queue
 java.util.LinkedList<AbstractGameAction> getGameActions()
          Returns the list of game actions
 void pause()
          Puts the game action scheduler to a paused state.
 void removeFirst()
          Removes first element in the game action queue
 void render(java.awt.Graphics2D g)
           
 void resume()
          Resumes the game action manager, if it was in an paused state
 void update(long elapsedTime)
          Uodates the queue of game actions
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameActionScheduler

public GameActionScheduler(AbstractCharacterSprite c)
Creates a new game action scheduler with the specified character as the owner. Just provide a this reference for the owner character when initializing the manager for an AbstractCharacterSprite

Parameters:
c - character this game action manager got instanciated for
Method Detail

pause

public void pause()
Puts the game action scheduler to a paused state. Game actions will not be processed then, but can be added though.


resume

public void resume()
Resumes the game action manager, if it was in an paused state


add

public void add(AbstractGameAction action)
Adds a game action to the queue of game actions.

Parameters:
action - game action to add to the game action queue

clear

public void clear()
Removes every game action from the queue of game actions


removeFirst

public void removeFirst()
Removes first element in the game action queue


getFirst

public AbstractGameAction getFirst()
Returns first element of the game action queue

Returns:
first element of the game action queue

getGameActions

public java.util.LinkedList<AbstractGameAction> getGameActions()
Returns the list of game actions

Returns:
list of game actions

containsActionsOtherThanWalk

public boolean containsActionsOtherThanWalk()
This methods determines whether there a game actions the queue that are other than walk game actions

Returns:
Are there game actions in the queue that are not walk actions

update

public void update(long elapsedTime)
Uodates the queue of game actions

Parameters:
elapsedTime - time between two frames

render

public void render(java.awt.Graphics2D g)