netwar.game.unit
Class UnitDefault2

java.lang.Object
  |
  +--netwar.game.GameObject
        |
        +--netwar.game.Unit
              |
              +--netwar.game.unit.UnitDefault2

public class UnitDefault2
extends Unit

Temporary Unit class. This will be removed in Iteration 2, when the real Units are created. This is a moderate speed, fragile, long range combatant. It has low armor, and uses a slow fire weapon (which is good against high armor targets).

Author:
Group N2 - Project Netwar, Daniel Grund

Fields inherited from class netwar.game.Unit
f, health, reserved, resF, resX, resY
 
Fields inherited from class netwar.game.GameObject
action, firstSSMDS, frame, GameObjects, goalX, goalY, mode, myID, myPlayer, reload, target, targetSSMDS, vr, x, y
 
Constructor Summary
UnitDefault2()
          Constuctor.
 
Method Summary
protected  void animateDie()
          Unit default2 dies by shrinking into a point.
protected  void animateMake()
          Unit default2 is created by the fin extending up from the black triangle.
protected  void animateMove()
          Unit default2 moves forward by sliding.
protected  void animateRotateLeft()
          Unit default2 rotates left by sliding.
protected  void animateRotateRight()
          Unit default2 rotates right by sliding.
protected  int armor()
          Unit default2 has an armor rating of 3
protected  void createVectors()
          Initialize the Point3Ds used for this Base.
 void draw(GameViewer v)
          Unit default 2 is drawn as two triangles.
protected  boolean fire()
          Unit default2 fires a ProjectileDefault2.
 int followRange()
          Unit default2 pursues to a range of 8 hexes.
protected  int framesToDie()
          Unit default2 uses 10 frames to display a death scene.
protected  int framesToMake()
          Unit default2 requires 10 frames to be created.
protected  int framesToMove()
          Unit default2 requires 10 frames to move forward one hex.
protected  int framesToRotate()
          Unit default2 requires 6 frames to rotate one hex-side.
 float getHeight()
          Unit default2 is 5 units tall.
 float getWidth()
          Unit default2 is 5 units wide.
protected  int maxHealth()
          Unit default2 has a maximum of 120 health.
 int weaponDelay()
          Unit default2 must wait 20 frames between shots.
 float weaponRangeSquared()
          Unit default2 has a weapon range of 200 units, or 10 hexes.
 
Methods inherited from class netwar.game.Unit
aim, bestDirection, confirmSubPlan, damageable, isDead, param, recieveDamage, setGoal, setGoal, setGoal, think, update
 
Methods inherited from class netwar.game.GameObject
center, getID, getMinimapColor, getObjectWithID, getPlayer, locate, newGameObject, removeMe, scan, scanRangeSquared, updateAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitDefault2

public UnitDefault2()
Constuctor. This Unit has no special parameters.
Method Detail

framesToMove

protected int framesToMove()
Unit default2 requires 10 frames to move forward one hex.
Overrides:
framesToMove in class Unit
Returns:
10

framesToRotate

protected int framesToRotate()
Unit default2 requires 6 frames to rotate one hex-side.
Overrides:
framesToRotate in class Unit
Returns:
6

framesToMake

protected int framesToMake()
Unit default2 requires 10 frames to be created.
Overrides:
framesToMake in class GameObject
Returns:
10

framesToDie

protected int framesToDie()
Unit default2 uses 10 frames to display a death scene.
Overrides:
framesToDie in class GameObject
Returns:
10

createVectors

protected void createVectors()
Description copied from class: GameObject
Initialize the Point3Ds used for this Base. These are the location of the ground-center of the Base in game-space, and the relative locations of the triangle/line vertices relative to that point.
Overrides:
createVectors in class GameObject

draw

public void draw(GameViewer v)
Unit default 2 is drawn as two triangles. A black triangle is drawn on ground level. A team-color triangle is drawn like a fin, extending up from the black triangle.
Overrides:
draw in class GameObject
Following copied from class: netwar.game.GameObject
Parameters:
v - The GameViewer which will display this GameObject.
See Also:
HexViewer

animateMove

protected void animateMove()
Unit default2 moves forward by sliding. No articulate animation is used.
Overrides:
animateMove in class Unit

animateRotateLeft

protected void animateRotateLeft()
Unit default2 rotates left by sliding. No articulate animation is used.
Overrides:
animateRotateLeft in class Unit

animateRotateRight

protected void animateRotateRight()
Unit default2 rotates right by sliding. No articulate animation is used.
Overrides:
animateRotateRight in class Unit

animateMake

protected void animateMake()
Unit default2 is created by the fin extending up from the black triangle.
Overrides:
animateMake in class GameObject

animateDie

protected void animateDie()
Unit default2 dies by shrinking into a point.
Overrides:
animateDie in class GameObject

getHeight

public float getHeight()
Unit default2 is 5 units tall.
Overrides:
getHeight in class GameObject
Returns:
5

getWidth

public float getWidth()
Unit default2 is 5 units wide.
Overrides:
getWidth in class GameObject
Returns:
5

weaponRangeSquared

public float weaponRangeSquared()
Unit default2 has a weapon range of 200 units, or 10 hexes.
Overrides:
weaponRangeSquared in class GameObject
Returns:
40000

followRange

public int followRange()
Unit default2 pursues to a range of 8 hexes.
Overrides:
followRange in class Unit
Returns:
8

weaponDelay

public int weaponDelay()
Unit default2 must wait 20 frames between shots.
Overrides:
weaponDelay in class GameObject
Returns:
20

fire

protected boolean fire()
Unit default2 fires a ProjectileDefault2. Projectile default2 is an arcing shot which can only damage its intended target. It explodes when it hits the ground.
Initial location = the upper tip of the fin.
Initial velocity = 10 units horizontally toward the target, plus a vertical component determined by the range.
Base damage = 25
Radius of explosion = 10 units.
Life of projectile = 50 cycles.
Overrides:
fire in class GameObject
Following copied from class: netwar.game.GameObject
Returns:
true iff the shot was successfully fired.

maxHealth

protected int maxHealth()
Unit default2 has a maximum of 120 health.
Overrides:
maxHealth in class Unit
Returns:
120

armor

protected int armor()
Unit default2 has an armor rating of 3
Overrides:
armor in class Unit
Returns:
3