|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--netwar.game.GameObject
Abstract class to define a GameObject.
This defines any object which:
occupies at least one Hex,
has vertical aspects (it isn't flat at z = 0),
(optionally) can be destroyed by weapons,
(optionally) has a weapon.
| Field Summary | |
protected int |
action
Code number indicating the animation sequence in progress. |
SelfSortingMutualDistanceSquared |
firstSSMDS
The head of the linked list which provides the distanceSquared and Point3D offset from this GameObject to each other GameObject, sorted from closest to farthest. |
protected int |
frame
The number of frames remaining until this animation sequence is completed. |
protected static Vector |
GameObjects
Vector of GameObjects containing all currently active GameObjects. |
protected int |
goalX
X part of the hex coord of the long term goal. |
protected int |
goalY
Y part of the hex coord of the long term goal. |
protected int |
mode
Code number indicating the long term goal set by this object. |
protected int |
myID
The ID number of this GameObject. |
protected Player |
myPlayer
The Player who owns this game Object. |
protected int |
reload
The number of frames remaining until the primary weapon is reloaded. |
protected GameObject |
target
The GameObject which is being pursued and/or shot at by this GameObject. |
protected SelfSortingMutualDistanceSquared |
targetSSMDS
The SSMDS which provides distanceSquared and offset data for the target. |
protected Point3D[] |
vr
Point3d's for locations within the hex. |
protected int |
x
X part of current hex coordinate. |
protected int |
y
Y part of current hex coordinate |
| Constructor Summary | |
GameObject()
|
|
| Method Summary | |
protected abstract boolean |
aim()
If a turret is available, rotate it toward the target. |
protected abstract void |
animateDie()
Perform the data changes for one frame of animation while dying. |
protected abstract void |
animateMake()
Perform the data changes for one frame of animation while being made. |
void |
center()
Cause the HexViewer's view to be centered on this GameObject. |
protected void |
createVectors()
Initialize the Point3Ds used for this Base. |
boolean |
damageable()
Return true if an explosion can possibly damage this object. |
abstract void |
draw(GameViewer v)
Draw this GameObject onto GameViewer v, by using v's drawing methods. |
protected boolean |
fire()
Attempt to fire a shot at the target. |
protected abstract int |
framesToDie()
Returns the number of frames of animation for the death sequence. |
protected abstract int |
framesToMake()
Returns the number of frames of animation for the creation sequence. |
abstract float |
getHeight()
Return the height of this GameObject for selection box and explosion hit calculations. |
int |
getID()
Accessor for ID. |
java.awt.Color |
getMinimapColor()
Get the Color for displaying this object on the minimap. |
static GameObject |
getObjectWithID(int ID)
Given an ID number, finds the GameObject with that ID. |
Player |
getPlayer()
Accessor for Player |
abstract float |
getWidth()
Return the width of this GameObject for selection box and explosion hit calculations. |
boolean |
isDead()
Return true if the object is not a valid target for attacks nor following. |
Point3D |
locate()
Accessor for vr[0]. |
static GameObject |
newGameObject(GameObject u,
int startX,
int startY,
int p,
Player team)
Adds a GameObject into the game at the specified location, on the specified team. |
protected void |
param(int p)
Arbitrary initialization. |
void |
recieveDamage(int dam)
Apply damage to this object. |
protected void |
removeMe()
Removes this GameObject from the game. |
protected GameObject |
scan()
GameObject scanner! Finds the nearest living enemy. |
float |
scanRangeSquared()
Determines the distance to scan for nearby enemies. |
abstract void |
setGoal()
Clear the current long-term goal. |
abstract void |
setGoal(GameObject u)
Set the current long-term goal to a GameObject. |
abstract void |
setGoal(int gx,
int gy)
Set the current long-term goal to a location, at hex coordinate (gx, gy). |
protected abstract void |
update()
Perform operations for this time step. |
static void |
updateAll()
Called by the game cycle update system to cause all GameObjects to perform one time-step of animations and decision making. |
abstract int |
weaponDelay()
Return the number of frames to wait between firing shots. |
abstract float |
weaponRangeSquared()
Return the square of the maximum weapon range of this GameObject. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static Vector GameObjects
protected int myID
protected Player myPlayer
public SelfSortingMutualDistanceSquared firstSSMDS
protected Point3D[] vr
protected int x
protected int y
protected int action
protected int frame
protected int reload
protected int mode
protected int goalX
protected int goalY
protected GameObject target
protected SelfSortingMutualDistanceSquared targetSSMDS
| Constructor Detail |
public GameObject()
| Method Detail |
public static GameObject newGameObject(GameObject u,
int startX,
int startY,
int p,
Player team)
u - The GameObject to be incorporated into the game.startX - The X part of the hex coordinate to start the object in.startY - The Y part of the hex coordinate to start the object in.p - The parameter for the arbitrary initialization method param().team - The player which owns this object. May be null, for a neutral object.protected void removeMe()
public static GameObject getObjectWithID(int ID)
ID - The ID number of the GameObject.protected GameObject scan()
public int getID()
public Player getPlayer()
public Point3D locate()
public abstract void setGoal()
public abstract void setGoal(int gx,
int gy)
gx - The x coordinate of the goal, in hex coords.gy - The y coordinate of the goal, in hex coords.public abstract void setGoal(GameObject u)
u - The GameObject which is the goal.public static void updateAll()
protected abstract void update()
protected abstract int framesToMake()
protected abstract int framesToDie()
protected void createVectors()
public abstract void draw(GameViewer v)
v - The GameViewer which will display this GameObject.HexViewerprotected abstract void animateMake()
protected abstract void animateDie()
public abstract float getHeight()
public abstract float getWidth()
public abstract float weaponRangeSquared()
public float scanRangeSquared()
public abstract int weaponDelay()
protected abstract boolean aim()
protected boolean fire()
protected void param(int p)
public java.awt.Color getMinimapColor()
public boolean isDead()
public boolean damageable()
public void recieveDamage(int dam)
dam - The number of damage points to be inflicted.public void center()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||