public class ObjectTracker extends java.lang.Object implements MessageDispatch
Modifier and Type | Class and Description |
---|---|
protected class |
ObjectTracker.Entry |
static class |
ObjectTracker.NotifyAggroRadiusMessage |
protected class |
ObjectTracker.NotifyData |
static interface |
ObjectTracker.NotifyReactionRadiusCallback |
static class |
ObjectTracker.NotifyReactionRadiusMessage |
static interface |
ObjectTracker.RemoteObjectFilter
A filter callback used to determine if a remote object should be tracked.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<OID,java.util.Map<OID,java.lang.Integer>> |
aggroRadiusMap |
protected EntityWithWorldNodeFactory |
entityFactory |
protected float |
hystericalMargin |
protected OID |
instanceOid |
protected java.util.Set<OID> |
localObjects
Local objects are perceivers; remote objects are the objects that are perceived by perceivers
|
static MessageType |
MSG_TYPE_NOTIFY_AGGRO_RADIUS |
static MessageType |
MSG_TYPE_NOTIFY_REACTION_RADIUS |
protected Namespace |
namespace |
protected ObjectTracker.NotifyReactionRadiusCallback |
notifyCallback |
protected java.util.Map<OID,ObjectTracker.NotifyData> |
reactionRadiusMap |
NO_FLAGS, RESPONSE_EXPECTED
Constructor and Description |
---|
ObjectTracker(Namespace namespace,
OID oid,
EntityWithWorldNodeFactory entityFactory,
java.util.Collection<ObjectType> subjectTypes) |
Modifier and Type | Method and Description |
---|---|
void |
addAggroRadius(OID oid,
OID target,
java.lang.Integer reactionRadius) |
void |
addLocalObject(OID oid,
java.lang.Integer reactionRadius) |
void |
addReactionRadius(OID oid,
java.lang.Integer reactionRadius) |
OID |
getInstanceOid() |
java.util.List<OID> |
getOidsInRadius(OID oid) |
void |
handleMessage(Message msg,
int flags)
Handle message.
|
protected void |
handlePerception(PerceptionMessage perceptionMessage) |
protected void |
maybeAddRemoteObject(PerceptionMessage.ObjectNote objectNote) |
protected void |
maybeRemoveRemoteObject(OID subjectOid,
PerceptionMessage.ObjectNote objectNote,
OID targetOid) |
void |
removeAggroRadius(OID oid,
OID target) |
boolean |
removeLocalObject(OID oid) |
void |
removeReactionRadius(OID oid) |
protected void |
removeRemoteObject(OID objOid,
OID oid,
boolean removeFromReactionRadius) |
void |
updateEntity(EntityWithWorldNode ewwn)
Checks the distance between the tracker and the entity in question to determine whether they are entering or leaving the reaction or aggro radius.
|
protected Namespace namespace
protected OID instanceOid
protected EntityWithWorldNodeFactory entityFactory
protected float hystericalMargin
protected ObjectTracker.NotifyReactionRadiusCallback notifyCallback
protected java.util.Set<OID> localObjects
protected java.util.Map<OID,ObjectTracker.NotifyData> reactionRadiusMap
public static final MessageType MSG_TYPE_NOTIFY_REACTION_RADIUS
public static final MessageType MSG_TYPE_NOTIFY_AGGRO_RADIUS
public ObjectTracker(Namespace namespace, OID oid, EntityWithWorldNodeFactory entityFactory, java.util.Collection<ObjectType> subjectTypes)
public OID getInstanceOid()
public void addLocalObject(OID oid, java.lang.Integer reactionRadius)
public void addReactionRadius(OID oid, java.lang.Integer reactionRadius)
public void removeReactionRadius(OID oid)
public boolean removeLocalObject(OID oid)
protected void maybeAddRemoteObject(PerceptionMessage.ObjectNote objectNote)
protected void removeRemoteObject(OID objOid, OID oid, boolean removeFromReactionRadius)
public void updateEntity(EntityWithWorldNode ewwn)
ewwn
- protected void handlePerception(PerceptionMessage perceptionMessage)
protected void maybeRemoveRemoteObject(OID subjectOid, PerceptionMessage.ObjectNote objectNote, OID targetOid)
public void handleMessage(Message msg, int flags)
MessageCallback
handleMessage
in interface MessageCallback
msg
- Message sent from other agent.flags
- Bitwise OR of MessageCallback.NO_FLAGS
, MessageCallback.RESPONSE_EXPECTED
.