|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrobocode.Event
robocode.CustomEvent
public class CustomEvent
This event is sent to onCustomEvent
when
a custom condition is met. Be sure to reset or remove the custom condition to
avoid having it reoccuring repeatedly.
getCondition()
Constructor Summary | |
---|---|
CustomEvent(Condition condition)
Called by the game to create a new CustomEvent when a condition is met. |
|
CustomEvent(Condition condition,
int priority)
Called by the game to create a new CustomEvent when a condition is met. |
Method Summary | |
---|---|
Condition |
getCondition()
Returns the condition that fired, causing this event to be generated. |
Methods inherited from class robocode.Event |
---|
compareTo, getPriority, getTime, setPriority, setTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CustomEvent(Condition condition)
condition
- the condition that must be metpublic CustomEvent(Condition condition, int priority)
This is equivalent to calling Condition.setPriority(int)
on the
Condition.
condition
- the condition that must be metpriority
- the priority of the conditionMethod Detail |
---|
public Condition getCondition()
public void onCustomEvent(CustomEvent event) { if (event.getCondition().getName().equals("mycondition")) { removeCustomEvent(event.getCondition()); doSomethingElse(); } }
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |