org.haphazard.gui.engine
Class GlobalWorld

java.lang.Object
  extended byorg.haphazard.XML.MessageHandler
      extended byorg.haphazard.gui.engine.GlobalWorld

public class GlobalWorld
extends MessageHandler

Handles the world


Field Summary
 java.util.Vector mEnemy
          Temporary variable to hold the evil twin(s)
 java.util.Vector mReusedEnemies
           
static Vector3D NE_DIRECTION
           
static Vector3D NW_DIRECTION
           
static Vector3D SE_DIRECTION
           
static Vector3D SW_DIRECTION
           
 
Fields inherited from class org.haphazard.XML.MessageHandler
mMessageBuffer
 
Method Summary
 Map getCurrentMap()
          Gets the current map
static GlobalWorld getInstance()
          Returns an instance of the world
 Map getMap(java.lang.String mapKey)
          Gets any of all the defined maps
static Point3D getOppositeDirection(Point3D direction)
          Returns the opposite direction
 void init()
          Initiates the world and loads all stuff
 void killAllEnemies()
           
 void paintComponent(java.awt.Graphics2D g, int windowWidth, int windowHeight)
          Paints the world
 void register(Action action)
          Registers an action
 void run()
          Starts the world thread
 void setIOHandler(IOHandler ioHandler)
           
 void spawn(Character character)
          Temporary function to spawn a new unit
 void unregister(Action action)
          Unregisters an action from the world
 
Methods inherited from class org.haphazard.XML.MessageHandler
addMessage, getNextMessage, hasMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NW_DIRECTION

public static final Vector3D NW_DIRECTION

SW_DIRECTION

public static final Vector3D SW_DIRECTION

NE_DIRECTION

public static final Vector3D NE_DIRECTION

SE_DIRECTION

public static final Vector3D SE_DIRECTION

mEnemy

public java.util.Vector mEnemy
Temporary variable to hold the evil twin(s)


mReusedEnemies

public java.util.Vector mReusedEnemies
Method Detail

getInstance

public static GlobalWorld getInstance()
Returns an instance of the world

Returns:
An instance of the world

init

public void init()
Initiates the world and loads all stuff


setIOHandler

public void setIOHandler(IOHandler ioHandler)

killAllEnemies

public void killAllEnemies()

getOppositeDirection

public static Point3D getOppositeDirection(Point3D direction)
Returns the opposite direction

Parameters:
direction - The direction to find the opposite for
Returns:
The opposite direction

getCurrentMap

public Map getCurrentMap()
Gets the current map

Returns:
The current visible map

getMap

public Map getMap(java.lang.String mapKey)
Gets any of all the defined maps

Parameters:
mapKey - The name of the map to get
Returns:
The map if it exists, null if it doesn't

register

public void register(Action action)
Registers an action

Parameters:
action - the action to register

unregister

public void unregister(Action action)
Unregisters an action from the world

Parameters:
action - The action to remove

run

public void run()
Starts the world thread


paintComponent

public void paintComponent(java.awt.Graphics2D g,
                           int windowWidth,
                           int windowHeight)
Paints the world

Parameters:
g - The graphics to use to paint it
windowWidth - The width of the window to paint in
windowHeight - The height of the window to paint in

spawn

public void spawn(Character character)
Temporary function to spawn a new unit

Parameters:
character - The character to respawn somewhere on the map