public class PatrolBehavior extends Behavior implements MessageCallback, java.lang.Runnable
Behavior.CommandMessage, Behavior.EventMessage
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.Float> |
lingerTimes |
protected float |
speed |
protected java.util.List<Point> |
waypoints |
lock, MSG_TYPE_COMMAND, MSG_TYPE_EVENT, obj
NO_FLAGS, RESPONSE_EXPECTED
Constructor and Description |
---|
PatrolBehavior() |
PatrolBehavior(SpawnData data) |
Modifier and Type | Method and Description |
---|---|
void |
activate() |
void |
addLingerTime(float time) |
void |
addWaypoint(Point wp) |
void |
deactivate() |
java.util.List<java.lang.Float> |
getLingerTimes() |
float |
getMovementSpeed() |
void |
handleMessage(Message msg,
int flags)
Handle message.
|
void |
initialize() |
protected void |
nextPatrol() |
void |
run() |
protected void |
sendMessage(Point waypoint,
float speed) |
void |
setMovementSpeed(float speed) |
protected void |
startPatrol()
Calculate the current position of the mob and work out where along the chain they are
|
dispatchMessage, getObjectStub, setObjectStub
protected java.util.List<Point> waypoints
protected java.util.List<java.lang.Float> lingerTimes
protected float speed
public PatrolBehavior()
public PatrolBehavior(SpawnData data)
public void initialize()
initialize
in class Behavior
public void deactivate()
deactivate
in class Behavior
public void handleMessage(Message msg, int flags)
MessageCallback
handleMessage
in interface MessageCallback
handleMessage
in class Behavior
msg
- Message sent from other agent.flags
- Bitwise OR of MessageCallback.NO_FLAGS
, MessageCallback.RESPONSE_EXPECTED
.public void addWaypoint(Point wp)
public void addLingerTime(float time)
public java.util.List<java.lang.Float> getLingerTimes()
public void setMovementSpeed(float speed)
public float getMovementSpeed()
protected void startPatrol()
protected void sendMessage(Point waypoint, float speed)
protected void nextPatrol()
public void run()
run
in interface java.lang.Runnable