com.threerings.tudey.server.logic
Class AgentLogic

java.lang.Object
  extended by com.threerings.util.ShallowObject
      extended by com.threerings.tudey.server.logic.Logic
          extended by com.threerings.tudey.server.logic.ActorLogic
              extended by com.threerings.tudey.server.logic.MobileLogic
                  extended by com.threerings.tudey.server.logic.ActiveLogic
                      extended by com.threerings.tudey.server.logic.AgentLogic
All Implemented Interfaces:
HasActor, TudeySceneManager.TickParticipant, ActorAdvancer.Environment

public class AgentLogic
extends ActiveLogic

Controls an autonomous agent.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.tudey.server.logic.ActorLogic
ActorLogic.CollisionFlagObserver
 
Nested classes/interfaces inherited from class com.threerings.tudey.server.logic.Logic
Logic.ShapeObserver
 
Constructor Summary
AgentLogic()
           
 
Method Summary
 boolean canMove()
          Checks whether we can move.
 boolean canRotate()
          Checks whether we can rotate.
 boolean canThink()
          Checks whether we can evaluate our behavior.
 void clearSpeed()
          Clears a modified speed.
 void clearTargetRotation()
          Clears the agent's target rotation.
 void clearTurnRate()
          Clears the turn rate.
 BehaviorLogic createBehavior(ConfigReference<BehaviorConfig> ref)
          Creates a behavior for this agent.
 void face(Logic logic)
          Sets the target rotation to face another entity.
 void face(Logic logic, boolean force)
          Sets the target rotation to face another entity.
 Logic getBehaviorTarget()
          Returns the logic currently being targeted by our behavior, if any.
 float getTargetRotation()
          Returns the target rotation.
 void setSpeed(float speed)
          Sets the speed.
 void setTargetRotation(float rotation)
          Sets the target rotation for the agent to turn towards.
 void setTurnRate(float rate)
          Sets the turn rate.
 void startMoving()
          Sets the agent in motion.
 void stopMoving()
          Stops the agent.
 boolean tick(int timestamp)
          Ticks the participant.
 void transfer(Logic source, Map<Object,Object> refs)
          Transfers state from the specified source logic.
 
Methods inherited from class com.threerings.tudey.server.logic.ActiveLogic
getActivityAdvance
 
Methods inherited from class com.threerings.tudey.server.logic.MobileLogic
collides, getDirection, getPenetration, getSceneModel, getSnapshot, stepLimit
 
Methods inherited from class com.threerings.tudey.server.logic.ActorLogic
addCollisionFlagObserver, addShapeObserver, bodyWillEnter, bodyWillLeave, destroy, getActivator, getActor, getCollisionFlags, getEntityKey, getModel, getPreviousSnapshot, getRotation, getShape, getShapeElement, getSnapshotDelta, getSource, getTags, getTranslation, init, isActive, isDefaultEntrance, isDestroyed, isRemoved, isStatic, move, remove, removeCollisionFlagObserver, removeShapeObserver, request, setActivator, setSource, setVariable, signal, warp, warp, warp
 
Methods inherited from class com.threerings.tudey.server.logic.Logic
getPatrolPath, getSceneManager, getTransform, getTransform, getVariable, init, isVisible, resolveTarget
 
Methods inherited from class com.threerings.util.ShallowObject
equals, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentLogic

public AgentLogic()
Method Detail

canMove

public boolean canMove()
Checks whether we can move.


canRotate

public boolean canRotate()
Checks whether we can rotate.


canThink

public boolean canThink()
Checks whether we can evaluate our behavior.


getBehaviorTarget

public Logic getBehaviorTarget()
Returns the logic currently being targeted by our behavior, if any.


face

public void face(Logic logic)
Sets the target rotation to face another entity.


face

public void face(Logic logic,
                 boolean force)
Sets the target rotation to face another entity.


setTargetRotation

public void setTargetRotation(float rotation)
Sets the target rotation for the agent to turn towards.


getTargetRotation

public float getTargetRotation()
Returns the target rotation.


clearTargetRotation

public void clearTargetRotation()
Clears the agent's target rotation.


setTurnRate

public void setTurnRate(float rate)
Sets the turn rate.


clearTurnRate

public void clearTurnRate()
Clears the turn rate.


setSpeed

public void setSpeed(float speed)
Sets the speed.


clearSpeed

public void clearSpeed()
Clears a modified speed.


startMoving

public void startMoving()
Sets the agent in motion.


stopMoving

public void stopMoving()
Stops the agent.


createBehavior

public BehaviorLogic createBehavior(ConfigReference<BehaviorConfig> ref)
Creates a behavior for this agent.


transfer

public void transfer(Logic source,
                     Map<Object,Object> refs)
Description copied from class: Logic
Transfers state from the specified source logic. Where relevant, this also takes the place of addition/startup notification.

Overrides:
transfer in class ActiveLogic

tick

public boolean tick(int timestamp)
Description copied from interface: TudeySceneManager.TickParticipant
Ticks the participant.

Specified by:
tick in interface TudeySceneManager.TickParticipant
Overrides:
tick in class ActiveLogic
Parameters:
timestamp - the timestamp of the current tick.
Returns:
true to continue ticking the participant, false to remove it from the list.


Copyright © 2011. All Rights Reserved.