|
|||||||||
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.MobileItem
unc.cdva.interactiveitems.Projectile
public class Projectile
Represents a projectile. Maintains the state of the projectile, and information as to where the projectile lands, and what it will land on. The projectile will 'fly' via the advanceTime method which advances the position of the projectile. The way it works is as follows, when the projectile is initially created it will be in the looking for hit state. It is calculated then what the projectile will hit, either a target, pathway, or the background. It is then set to the appropriate exploding state. When the projectile finally actually travels to where it is supposed to land, it then goes into the exploding state, and explodes. NOTE: The id of the projectile will match the id of problem given in the constructor.
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 | |
---|---|
Projectile(Gun gun,
javax.vecmath.Vector3f landingPoint,
Id problemId)
Initializes a projectile object. |
Method Summary | |
---|---|
void |
advanceInTime(long delta)
Advances time for the projectile, it will move by a certain distance according to the given time interval. |
void |
explodeBackground()
Sets the state of the projecitle to exploding over the background, change to this state as soon as it is known that the projectile will miss it's targets and is overshot missing even the pathway (river). |
void |
explodePathway()
Sets the state of the projecitle to exploding over the pathway, change to this state as soon as it is known that the projectile will miss it's targets and will explode on the pathway. |
void |
explodeTarget()
Sets the projectile to explode target, change to this state as soon as it is determined that the projectile will hit a target. |
void |
exploding()
Sets the state of the projectile to exploding, ie the projectile has arrived to it's target and should then blow up. |
javax.vecmath.Vector3f |
getLandingPoint()
Getter for the landing point. |
boolean |
isExplodeBackground()
|
boolean |
isExplodePathway()
|
boolean |
isExplodeTarget()
|
boolean |
isExploding()
|
boolean |
isLookingForHitSurface()
|
void |
lookingForHitSurface()
The very initial state of a projectile. |
void |
setLandingPoint(javax.vecmath.Vector3f landingPoint)
Setter for the landing point, the projectile will explode when it reaches this point, the projectile will also be shot and travel from the gun to this point. |
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 |
---|
public Projectile(Gun gun, javax.vecmath.Vector3f landingPoint, Id problemId)
gun
- The gun that is firing the object.landingPoint
- Where the object is to land.problemId
- The id of the problem that corresponds
to the projectile. This id will be used to tag the projectile
object. For every problem the user places a reticle,
and clicks fire to fire the gun, placement of the reticle involves
the creation of a problem whose id is used to tag everything
associated with it, including the projectile.Method Detail |
---|
public void advanceInTime(long delta)
advanceInTime
in class MobileItem
delta
- the amount of time to elapse (in ms)public void explodeTarget()
public void explodePathway()
public void explodeBackground()
public void exploding()
public void lookingForHitSurface()
public boolean isExplodeTarget()
public boolean isExplodePathway()
public boolean isExplodeBackground()
public boolean isExploding()
public boolean isLookingForHitSurface()
public void setLandingPoint(javax.vecmath.Vector3f landingPoint)
landingPoint
- The landing point to set.public javax.vecmath.Vector3f getLandingPoint()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |