unc.cdva.interactiveitems
Class RangeCar

java.lang.Object
  extended by unc.cdva.utils.TaggedObject
      extended by unc.cdva.interactiveitems.InteractiveItem
          extended by unc.cdva.interactiveitems.AnimatedItem
              extended by unc.cdva.interactiveitems.MobileItem
                  extended by unc.cdva.interactiveitems.RangeCar
All Implemented Interfaces:
Taggable

public class RangeCar
extends MobileItem

RangeCar object, keeps track of the rangecars state. There is a one to one mapping between players, guns, and rangecars. Given the one to one mapping, a rangeCar simply has the same Id as the player who owns the rangeCar. Rangecar has a simple implementation thus far, and is either moving or stationary. TODO Have the range car actually turn around, rather than flipping directions.

Author:
Dan Van Atta, Guillaume Conte

Field Summary
 
Fields inherited from class unc.cdva.interactiveitems.MobileItem
MOVING, STOPPED
 
Fields inherited from class unc.cdva.interactiveitems.InteractiveItem
direction, position, scaling
 
Constructor Summary
RangeCar(Id playerId, Gun gun)
          Constructor for a rangecar.
 
Method Summary
 void advanceInTime(long delta)
          Moves the range car, which moves at a certain speed, thus for the amount of time that has elapsed, the rangecar will move the right amount in the direction it is 'facing'.
 javax.vecmath.Vector3f getDestination()
           
 void setDestination(javax.vecmath.Vector3f destination)
          Sets the destination of the range car.
 
Methods inherited from class unc.cdva.interactiveitems.MobileItem
isMoving, isStopped, setMoving, setStopped
 
Methods inherited from class unc.cdva.interactiveitems.InteractiveItem
getDirection, getPdsBean, getPosition, getScaling, getState, setDirection, setPds, setPosition, setScaling, setState
 
Methods inherited from class unc.cdva.utils.TaggedObject
createId, equals, getId, hashCode, setId, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeCar

public RangeCar(Id playerId,
                Gun gun)
Constructor for a rangecar. All that is required is the id of the player associated with the rangecar.

Parameters:
playerId - The id of the player the range car is associated with.
gun - Used to place the initial position of the rangecar.
Method Detail

advanceInTime

public void advanceInTime(long delta)
Moves the range car, which moves at a certain speed, thus for the amount of time that has elapsed, the rangecar will move the right amount in the direction it is 'facing'.

Specified by:
advanceInTime in class MobileItem
Parameters:
delta - The amount of time in ms to elapse.

setDestination

public void setDestination(javax.vecmath.Vector3f destination)
Sets the destination of the range car. It will move towards this destination.

Parameters:
destination - Where the range car should move to.

getDestination

public javax.vecmath.Vector3f getDestination()
Returns:
The destination of the range car, where it is travelling to.