netwar.game.unit
Class UnitDefault

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

public class UnitDefault
extends Unit

Temporary Unit class. This will be removed in Iteration 2, when the real Units are created. This is a fast, durable, short range combatant. It has good armor, and uses a rapid fire weapon (which is good against low armor targets). Because of its long range, it has an extended scan range so that it can automatically approach enemies.

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
UnitDefault()
          Constructor.
 
Method Summary
protected  void animateDie()
          Unit default forms by compressing horizontally while extending vertically until it becomes a line and disappears.
protected  void animateMake()
          Unit default forms by shifting the triangles from a nearly verticle form to the standard shape.
protected  void animateMove()
          Unit default moves by sliding.
protected  void animateRotateLeft()
          Unit default rotates left by sliding.
protected  void animateRotateRight()
          Unit default rotates right by sliding.
protected  int armor()
          Unit default has an armor rating of 5
protected  void createVectors()
          Initialize the Point3Ds used for this Base.
 void draw(GameViewer v)
          Unit default is drawn as two triangles.
protected  boolean fire()
          Unit default fires a ProjectileDefault.
 int followRange()
          Unit default pursues to a range of 3 hexes.
protected  int framesToDie()
          Unit default spends 10 frames doing a death scene.
protected  int framesToMake()
          Unit default requires 10 frames to be created.
protected  int framesToMove()
          Unit default requires 5 frames to move forward one hex.
protected  int framesToRotate()
          Unit default requires 3 frames to rotate one hex-side.
 float getHeight()
          Unit default is 1.0 units tall.
 float getWidth()
          Unit default is 7.0 units wide.
protected  int maxHealth()
          Unit default has a maximum of 100 health.
 float scanRangeSquared()
          Unit default uses a scan range of 160.0 units, or 8 hexes.
 int weaponDelay()
          Unit default can fire every fifth frame.
 float weaponRangeSquared()
          Unit default has a weapon range of 80.0 units, or 4 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, updateAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitDefault

public UnitDefault()
Constructor. This Unit has no special parameters.
Method Detail

framesToMove

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

framesToRotate

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

framesToMake

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

framesToDie

protected int framesToDie()
Unit default spends 10 frames doing 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 is drawn as two triangles. The triangles form together to form a triangle with a slight fold. One triangle is the slightly brighter than the team color, the other is slightly darker.
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 default moves by sliding. There is no articulate animation.
Overrides:
animateMove in class Unit

animateRotateLeft

protected void animateRotateLeft()
Unit default rotates left by sliding. There is no articulate animation
Overrides:
animateRotateLeft in class Unit

animateRotateRight

protected void animateRotateRight()
Unit default rotates right by sliding. There is no articulate animation
Overrides:
animateRotateRight in class Unit

animateMake

protected void animateMake()
Unit default forms by shifting the triangles from a nearly verticle form to the standard shape.
Overrides:
animateMake in class GameObject

animateDie

protected void animateDie()
Unit default forms by compressing horizontally while extending vertically until it becomes a line and disappears.
Overrides:
animateDie in class GameObject

getHeight

public float getHeight()
Unit default is 1.0 units tall.
Overrides:
getHeight in class GameObject
Returns:
1

getWidth

public float getWidth()
Unit default is 7.0 units wide.
Overrides:
getWidth in class GameObject
Returns:
7

weaponRangeSquared

public float weaponRangeSquared()
Unit default has a weapon range of 80.0 units, or 4 hexes.
Overrides:
weaponRangeSquared in class GameObject
Returns:
6400

scanRangeSquared

public float scanRangeSquared()
Unit default uses a scan range of 160.0 units, or 8 hexes.
Overrides:
scanRangeSquared in class GameObject
Returns:
25600

followRange

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

weaponDelay

public int weaponDelay()
Unit default can fire every fifth frame.
Overrides:
weaponDelay in class GameObject
Returns:
5

fire

protected boolean fire()
Unit default fires a ProjectileDefault. Projectile default is a straight flying shot which can only damage its intended target. It explodes when the angle between it velocity and the vector to its target exceeds 90 degrees.
Initial location = one unit above the ground-center.
Initial velocity = five units, level with the ground, toward the target unit.
Base damage = 10
Radius of explosion = 5 units.
Life of projectile = 18 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 default has a maximum of 100 health.
Overrides:
maxHealth in class Unit
Returns:
100

armor

protected int armor()
Unit default has an armor rating of 5
Overrides:
armor in class Unit
Returns:
5