|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunc.cdva.utils.TaggedObject
unc.cdva.interactiveitems.InteractiveItem
unc.cdva.interactiveitems.AnimatedItem
unc.cdva.interactiveitems.Gun
public class Gun
Gun object, essentially stores the state of a players gun. The state information is used when rendering the gun. There is some other data associated with a gun, for example the reload time, and data to specify where a projectile is to originate. NOTE: There are two id's to this class, a userId, and an id for the gun object.
Field Summary |
---|
Fields inherited from class unc.cdva.interactiveitems.InteractiveItem |
---|
direction, position, scaling |
Constructor Summary | |
---|---|
Gun(Id userId,
PdsBean pds)
Gun constructor, uses a default value for the muzzle height, the other two values needed by the gun object are passed in as parameters. |
|
Gun(Id userId,
PdsBean pds,
javax.vecmath.Vector2f muzzleHeight)
Gun constructor that initializes the internal state of the gun. |
Method Summary | |
---|---|
void |
advanceInTime(long delta)
If the gun is reloading, then the amount of time until it is done is decreased, if the gun has spent long enough reloading, then it is set back to the ready state. |
void |
fire()
Toggles the fire state. |
static javax.vecmath.Vector2f |
getMuzzleHeight()
|
javax.vecmath.Vector3f |
getProjectileStartPos()
Given the 2d muzzle height vector, calculates where the projectile should originate (the end of the muzzle) |
static java.lang.Long |
getReloadTime()
|
boolean |
isFiring()
The gun is in the firing state when it is in the act of firing. |
boolean |
isReady()
Indicates if in the ready state. |
boolean |
isReloading()
The gun is in the reloading state for some amount of time after it has fired. |
void |
ready()
Toggles the ready state. |
void |
reload()
Toggles the ready state. |
static void |
setMuzzleHeight(javax.vecmath.Vector2f muzzleHeight)
|
static void |
setReloadTime(long reloadTime)
|
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 |
---|
public Gun(Id userId, PdsBean pds)
userId
- The id of the user who 'owns' teh gun.pds
- A pds for the placement of the gun object.public Gun(Id userId, PdsBean pds, javax.vecmath.Vector2f muzzleHeight)
userId
- The id of the player who 'owns' the gun.pds
- PDS bean, used for the gun placement.muzzleHeight
- A 2d vector represMethod Detail |
---|
public void advanceInTime(long delta)
advanceInTime
in class AnimatedItem
delta
- The amount of time to elapse.public javax.vecmath.Vector3f getProjectileStartPos()
public void ready()
public void fire()
public void reload()
public boolean isReady()
public boolean isReloading()
public boolean isFiring()
public static javax.vecmath.Vector2f getMuzzleHeight()
public static java.lang.Long getReloadTime()
public static void setMuzzleHeight(javax.vecmath.Vector2f muzzleHeight)
muzzleHeight
- The muzzleHeight to set.public static void setReloadTime(long reloadTime)
reloadTime
- The reloadTime to set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |