gecco.server.core
Class EventHandler
java.lang.Object
|
+--gecco.server.core.EventHandler
- Direct Known Subclasses:
- BaseStationEventHandler, FirefighterEventHandler, HelicopterEventHandler, ShipEventHandler, TestUnitEventHandler
- public abstract class EventHandler
- extends Object
This class represents an event handler for a unit. All event handlers should
be subclasses of this class. An event handler should take care of the
occasions when an event is sent to a unit, for example, when the unit stands
on an automaton that affects unit in some way.
- Author:
- Henrik Bäärnhielm, Karl Hasselström, Henrik Hägeström.
Constructor Summary |
EventHandler()
Constructor for the EventHandler object |
Method Summary |
abstract void |
handleEvent(UnitEvent event,
Unit unit)
The method that is called by the game engine when a unit of a unit type
with this event handler receives a message. |
protected void |
sendUnitMessage(Unit unit,
String unitMessage)
Sends a message to all observers of a given (as well as to all roles
with status as god's eye). |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
EventHandler
public EventHandler()
- Constructor for the EventHandler object
handleEvent
public abstract void handleEvent(UnitEvent event,
Unit unit)
- The method that is called by the game engine when a unit of a unit type
with this event handler receives a message. Most of the code of the
event handler will be in this method.
- Parameters:
event
- The event.unit
- The unit affected by the event.
sendUnitMessage
protected void sendUnitMessage(Unit unit,
String unitMessage)
- Sends a message to all observers of a given (as well as to all roles
with status as god's eye).
- Parameters:
unit
- The unit.unitMessage
- The message to be sent.