demo.helicopter
Class AgentTankActionInterpreter
java.lang.Object
java.lang.Thread
demo.helicopter.AgentTankActionInterpreter
- All Implemented Interfaces:
- java.lang.Runnable
- public class AgentTankActionInterpreter
- extends java.lang.Thread
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
OFFENSIVE
public static final int OFFENSIVE
- See Also:
- Constant Field Values
DEFENSIVE
public static final int DEFENSIVE
- See Also:
- Constant Field Values
AgentTankActionInterpreter
public AgentTankActionInterpreter(java.lang.String ipAddr,
int portNum,
int timeToLive,
short siteNum,
short appNum,
short idNum,
java.lang.String marking,
boolean rtpHeaderEnabled,
AgentTankControlPanel panel)
run
public void run()
setIsCollided
public void setIsCollided(boolean setValue)
getIsCollided
public boolean getIsCollided()
setDriving
public void setDriving(boolean setValue)
getDriving
public boolean getDriving()
setSpeed
public void setSpeed(float spd)
getSpeed
public double getSpeed()
setTurnAngle
public void setTurnAngle(float turnAngle)
getEspdu
public EntityStatePdu getEspdu()
startDriving
public void startDriving()
setOffensive
public void setOffensive()
setDefensive
public void setDefensive()
getOffensive
public boolean getOffensive()
getDefensive
public boolean getDefensive()
runAgent
public void runAgent()
getFlag
public void getFlag(EntityStatePdu enemyFlagEspdu)
protectFlag
public void protectFlag(EntityStatePdu friendlyFlagEspdu)
engageEnemy
public void engageEnemy(EntityStatePdu enemyUnitEspdu)
resetTurret
public void resetTurret()
driveToHere
public void driveToHere(EntityStatePdu here)
interceptAngle
public int interceptAngle(EntityStatePdu me,
EntityStatePdu target)
relativeTurretAngle
public int relativeTurretAngle()
checkForGroundCollision
public void checkForGroundCollision()
stopRun
public void stopRun()
checkForGunElevate
public void checkForGunElevate()
checkForTurretTurn
public void checkForTurretTurn()
checkForReload
public void checkForReload()
selfDestruct
public void selfDestruct()
getFrameHeaderInfo
public java.lang.String getFrameHeaderInfo()
reset
public void reset()
sendFirePdu
public void sendFirePdu()
sendMainFirePdu
public void sendMainFirePdu()
brake
public void brake()
leftTurretTurn
public void leftTurretTurn()
rightTurretTurn
public void rightTurretTurn()
elevateGun
public void elevateGun()
depressGun
public void depressGun()
collectSensorPdus
public void collectSensorPdus()
interpretProtocol
public void interpretProtocol(java.util.Vector receivedData)
checkFirePdu
public void checkFirePdu(FirePdu shot)
- Function Works as Follows :
1. Get X, Y, Z components of launch velocity.
2. Calculate launch velocity vector.
3. Get X, Y, Z location of the launch.
4. Get X, Y, Z velocity componets of this tank at launch.
5. Get X, Y, Z location of this tank at launch.
6. Calculate the distance between this tank and the launch point.
7. Calculate the relative velocity of the fire with respect to this tank.
8. Find the time to fly for this distance.
9. Find the actual X, Y, Z location for the fire after "time to fly".
10. Calculate the distance between this tank and the new location of the
fire after "time to fly".
11. If the distance is equal to or less than HIT_RADIUS a hit has occured.
- Parameters:
shot
- Fire PDU that is being checked.
checkCollision
public void checkCollision(EntityStatePdu entityPdu)
determineRange
public double determineRange(EntityStatePdu firstEspu,
EntityStatePdu secondEspdu)