com.threerings.tudey.util
Class ActorAdvancer

java.lang.Object
  extended by com.threerings.tudey.util.ActorAdvancer
Direct Known Subclasses:
MobileAdvancer

public class ActorAdvancer
extends Object

Used on the client and the server to advance the state of an actor based on its state and surroundings.


Nested Class Summary
static interface ActorAdvancer.Environment
          Provides a callback mechanism to allow the advancer to query the actor's environment while advancing it.
 
Field Summary
protected  Actor _actor
          The current actor state.
protected  ActorAdvancer.Environment _environment
          The actor's environment.
protected  Shape _shape
          The shape of the actor.
protected  int _timestamp
          The timestamp at which the state is valid.
protected  Transform2D _transform
          Used to store the actor's transform.
 
Constructor Summary
ActorAdvancer(ActorAdvancer.Environment environment, Actor actor, int timestamp)
          Creates a new advancer for the supplied actor.
 
Method Summary
 void advance(int timestamp)
          Advances the actor to the specified timestamp.
 Actor getActor()
          Returns a reference to the advancer actor.
 int getTimestamp()
          Returns the advancer timestamp.
 void init(Actor actor, int timestamp)
          (Re)initializes the advancer.
 void jump(int timestamp)
          Jumps to the specified timestamp without actually taking a step.
protected  void step(float elapsed)
          Takes an Euler step of the specified length.
 void transfer(ActorAdvancer source)
          Transfers state from the specified source advancer.
protected  void updateShape()
          Updates the stored shape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_environment

protected ActorAdvancer.Environment _environment
The actor's environment.


_actor

protected Actor _actor
The current actor state.


_timestamp

protected int _timestamp
The timestamp at which the state is valid.


_shape

protected Shape _shape
The shape of the actor.


_transform

protected Transform2D _transform
Used to store the actor's transform.

Constructor Detail

ActorAdvancer

public ActorAdvancer(ActorAdvancer.Environment environment,
                     Actor actor,
                     int timestamp)
Creates a new advancer for the supplied actor.

Method Detail

getActor

public Actor getActor()
Returns a reference to the advancer actor.


getTimestamp

public int getTimestamp()
Returns the advancer timestamp.


init

public void init(Actor actor,
                 int timestamp)
(Re)initializes the advancer.


transfer

public void transfer(ActorAdvancer source)
Transfers state from the specified source advancer.


advance

public void advance(int timestamp)
Advances the actor to the specified timestamp.


jump

public void jump(int timestamp)
Jumps to the specified timestamp without actually taking a step.


step

protected void step(float elapsed)
Takes an Euler step of the specified length.


updateShape

protected void updateShape()
Updates the stored shape.