Class Unit

java.lang.Object
  |
  +--Unit
Direct Known Subclasses:
AirTrans, BomberUnit, DestroyerUnit, MissleUnit, RPGUnit, SoldierUnit, TankUnit

class Unit
extends java.lang.Object


Field Summary
(package private)  int armor
           
(package private)  boolean attacked
           
(package private)  int cost
           
(package private)  int firepower
           
(package private) static java.awt.Color forest
           
(package private)  int health
           
(package private)  int maxHealth
           
(package private)  boolean moved
           
(package private)  int movementRange
           
(package private)  Unit nextUnit
           
(package private)  int number
           
(package private)  java.util.LinkedList passableTerrain
           
(package private)  int posx
           
(package private)  int posy
           
(package private)  int prevx
           
(package private)  int prevy
           
(package private)  java.lang.String type
           
(package private)  javax.swing.ImageIcon unitIcon
           
(package private) static java.awt.Color water
           
 
Constructor Summary
Unit()
           
Unit(int h, int a, int f)
           
Unit(int h, int a, int f, int x, int y)
           
Unit(int h, int a, int f, int m, java.lang.String s)
           
Unit(java.lang.String s)
           
 
Method Summary
protected  void addPassableTerrain(java.awt.Color c)
           
 int getArmor()
           
 int getCost()
           
 int getFirePower()
           
 int getHealth()
           
 javax.swing.ImageIcon getIcon()
           
 int getMaxHealth()
           
 int getMovementRange()
           
 Unit getNext()
           
 int getNumber()
           
 int getOldX()
           
 int getOldY()
           
 int getPositionX()
           
 int getPositionY()
           
 java.lang.String getType()
           
 boolean hasAttacked()
           
 boolean hasMoved()
           
 boolean isPassable(MapBoard.TerrainNode t)
          Returns whether or not a particular type of terrain is passable given the terrain node in question.
 void setAttacked(boolean b)
           
 void setHealth(int h)
           
 void setIcon(javax.swing.ImageIcon i)
           
 void setMoved(boolean b)
           
 void setNext(Unit u)
           
 void setNumber(int i)
           
 void setPositionX(int x)
           
 void setPositionY(int y)
           
 void takeDamage(int d)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

number

int number

firepower

int firepower

armor

int armor

health

int health

maxHealth

int maxHealth

posx

int posx

posy

int posy

prevx

int prevx

prevy

int prevy

moved

boolean moved

attacked

boolean attacked

movementRange

int movementRange

cost

int cost

type

java.lang.String type

passableTerrain

java.util.LinkedList passableTerrain

nextUnit

Unit nextUnit

unitIcon

javax.swing.ImageIcon unitIcon

forest

static java.awt.Color forest

water

static java.awt.Color water
Constructor Detail

Unit

public Unit()

Unit

public Unit(java.lang.String s)

Unit

public Unit(int h,
            int a,
            int f)

Unit

public Unit(int h,
            int a,
            int f,
            int x,
            int y)

Unit

public Unit(int h,
            int a,
            int f,
            int m,
            java.lang.String s)
Method Detail

addPassableTerrain

protected void addPassableTerrain(java.awt.Color c)

isPassable

public boolean isPassable(MapBoard.TerrainNode t)
Returns whether or not a particular type of terrain is passable given the terrain node in question.

getType

public java.lang.String getType()

getHealth

public int getHealth()

setHealth

public void setHealth(int h)

getMaxHealth

public int getMaxHealth()

takeDamage

public void takeDamage(int d)

getArmor

public int getArmor()

getFirePower

public int getFirePower()

setNumber

public void setNumber(int i)

getNumber

public int getNumber()

getPositionX

public int getPositionX()

setPositionX

public void setPositionX(int x)

getPositionY

public int getPositionY()

setPositionY

public void setPositionY(int y)

getOldX

public int getOldX()

getOldY

public int getOldY()

getMovementRange

public int getMovementRange()

hasMoved

public boolean hasMoved()

setMoved

public void setMoved(boolean b)

hasAttacked

public boolean hasAttacked()

setAttacked

public void setAttacked(boolean b)

getCost

public int getCost()

getNext

public Unit getNext()

setNext

public void setNext(Unit u)

setIcon

public void setIcon(javax.swing.ImageIcon i)

getIcon

public javax.swing.ImageIcon getIcon()