atavism.agis.behaviors
Class PatrolBehavior
java.lang.Object
atavism.server.engine.Behavior
atavism.agis.behaviors.PatrolBehavior
- All Implemented Interfaces:
- MessageCallback, MessageDispatch, java.io.Serializable, java.lang.Runnable
public class PatrolBehavior
- extends Behavior
- implements MessageCallback, java.lang.Runnable
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
waypoints
protected java.util.List<Point> waypoints
lingerTimes
protected java.util.List<java.lang.Float> lingerTimes
speed
protected float speed
PatrolBehavior
public PatrolBehavior()
PatrolBehavior
public PatrolBehavior(SpawnData data)
initialize
public void initialize()
- Overrides:
initialize
in class Behavior
activate
public void activate()
- Specified by:
activate
in class Behavior
deactivate
public void deactivate()
- Specified by:
deactivate
in class Behavior
handleMessage
public void handleMessage(Message msg,
int flags)
- Description copied from interface:
MessageCallback
- Handle message.
- Specified by:
handleMessage
in interface MessageCallback
- Specified by:
handleMessage
in class Behavior
- Parameters:
msg
- Message sent from other agent.flags
- Bitwise OR of MessageCallback.NO_FLAGS
, MessageCallback.RESPONSE_EXPECTED
.
addWaypoint
public void addWaypoint(Point wp)
addLingerTime
public void addLingerTime(float time)
getLingerTimes
public java.util.List<java.lang.Float> getLingerTimes()
setMovementSpeed
public void setMovementSpeed(float speed)
getMovementSpeed
public float getMovementSpeed()
startPatrol
protected void startPatrol()
- Calculate the current position of the mob and work out where along the chain they are
sendMessage
protected void sendMessage(Point waypoint,
float speed)
nextPatrol
protected void nextPatrol()
run
public void run()
- Specified by:
run
in interface java.lang.Runnable