|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hermes.Interactor<A,B>
A
- The first type of HObject
in the interaction.B
- The second type of HObject
in the interaction.public abstract class Interactor<A extends HObject,B extends HObject>
An Interactor
defines some conditional relationship between two HObject
s.
It provides a method of detecting whether the objects are interacting, and
a method of executing/handling the resultant interaction.
This is the primary means of writing
conditional logic into the World
game loop.
Constructor Summary | |
---|---|
protected |
Interactor()
Constructs a new Interactor using default settings. |
protected |
Interactor(boolean applyImmediate,
boolean multisample)
Constructs a new Interactor, setting whether the Interactor will be handled upon detection or deferred, and whether the Interactor will be multisampled. |
Method Summary | |
---|---|
boolean |
appliedImmediately()
Whether the Interactor is applied upon detection, or deferred until all possible interactions have been checked for the step. |
abstract boolean |
detect(A object1,
B object2)
Determines whether an interaction between two objects has occurred. |
abstract void |
handle(A object1,
B object2)
Handles the result of an interaction that has been detected (by detect return true)
for a pair of objects. |
boolean |
multisampled()
Whether the Interactor is checked for each step of the objects it is registered with, or only once per update. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Interactor(boolean applyImmediate, boolean multisample)
applyImmediate
- If true, the Interactor will be applied by World as soon as
detect
has returned true. If false, it will
be applied only when all possible interactions have been checked
for the step, for the entire World.multisample
- If true, the Interactor will be checked for and applied
for each interacting object for each step, against all
all objects it may interact with. If false, it will be
checked for and applied only once per update of the loop,
on the first step.protected Interactor()
detect
has returned true, and will be applied on once per update (not multisampled).
Use this constructor unless you understand multisampling and delayed application and need it for a specific purpose.
Method Detail |
---|
public boolean appliedImmediately()
handle
immediately upon
detect
returning true. If false, it will wait until the
end of the loop, after all interactions have been checked.public boolean multisampled()
public abstract boolean detect(A object1, B object2)
object1
- the first interacting objectobject2
- the second interacting object
public abstract void handle(A object1, B object2)
detect
return true)
for a pair of objects.
object1
- the first objectobject2
- the second object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |