|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deken.game.trigger.Trigger
public abstract class Trigger
Title: Trigger
Description: The Trigger base class, sets up the requirements for a trigger event. It needs to be updated every tick in the game loop. This class stores the listeners and activates them, when the checkTrigger is successful.
Copyright: Copyright (c) Sep 1, 2012
Nested Class Summary | |
---|---|
static class |
Trigger.TRIGGER_TIMES
|
Field Summary | |
---|---|
protected boolean |
activated
|
Constructor Summary | |
---|---|
Trigger()
|
Method Summary | |
---|---|
protected void |
activateListeners()
Activate the TriggerListeners that this Trigger has been activated. |
boolean |
addListener(TriggerListener listener)
Adds a TriggerListener to this trigger, so that it will be notified when this trigger is invoked. |
protected abstract void |
checkTrigger(long elapseTime)
Checks if the Trigger needs to be invoked. |
protected void |
deactivateListeners()
Deactivate the TriggerListeners that this Trigger has been deactivated. |
java.lang.String |
getName()
|
boolean |
removeListener(TriggerListener listener)
Removes a TriggerListener from this trigger, so that it will no longer be notified when this trigger is invoked. |
void |
reset()
Resets this Trigger so that it can be invoked again. |
void |
setName(java.lang.String name)
|
void |
setTimesActivated(int timesActivated)
Set the number of times this trigger can be activated. |
void |
setTimesActivated(Trigger.TRIGGER_TIMES times)
|
void |
stopTrigger()
Stops this Trigger from check if it needs to be activated. |
void |
update(long elapseTime)
Every tick, this trigger checks if it needs to be activated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean activated
Constructor Detail |
---|
public Trigger()
Method Detail |
---|
public boolean addListener(TriggerListener listener)
listener
-
public java.lang.String getName()
getName
in interface Updateable
public boolean removeListener(TriggerListener listener)
listener
-
public void reset()
public void setName(java.lang.String name)
public void setTimesActivated(int timesActivated)
timesActivated
- public void setTimesActivated(Trigger.TRIGGER_TIMES times)
public void stopTrigger()
public void update(long elapseTime)
update
in interface Updateable
elapseTime
- protected void activateListeners()
protected abstract void checkTrigger(long elapseTime)
elapseTime
- protected void deactivateListeners()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |