Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Unit Class Reference

#include <unit.h>

Inheritance diagram for Unit::

UnitCommandCenter UnitMarine List of all members.

Public Methods

 Unit (Game *pgame)
virtual ~Unit ()
virtual int action (int actionnum, Vector destpos)=0
virtual void setPrimaryAction (int actionnum)
virtual int primaryAction (Vector destpos)
virtual void setUnitPosition (Vector pos)=0
virtual VectorgetUnitPosition (void)=0
bool isSelected ()
bool screenSelect (Vector sel1, Vector sel2)
Unit * getTarget ()
void setTarget (Unit *enemy)
void setTarget (int player, int unitnum)
enum UnitTypes getUnitType ()
float getHitpoints ()
float getMaxHitpoints ()
void setHitpoints (float percent)
void decreaseHitpoints (float amount)
void increaseHitpoints (float amount)
bool isAlive ()
virtual int render ()=0
virtual int step ()=0

Protected Methods

void setMaxHitpoints (float maxpoints)
void setUnitType (enum UnitTypes type)

Private Attributes

RendereruRenderer
GameuGame
GrounduGround
Player ** uPlayers
int primaryActionNum
bool bIsSelected
Unit * uTarget
int uTargetNum
int uTargetPlayer
float maxhitpoints
float hitpoints
enum UnitTypes unittype

Constructor & Destructor Documentation

Unit::Unit Game *   pgame
 

virtual Unit::~Unit   [virtual]
 


Member Function Documentation

virtual int Unit::action int   actionnum,
Vector   destpos
[pure virtual]
 

Set orders for unit, implementation required in all units.

Reimplemented in UnitCommandCenter, and UnitMarine.

void Unit::decreaseHitpoints float   amount [inline]
 

Reduce amount of hitpoints by "amount".

float Unit::getHitpoints   [inline]
 

Return number of hitpoints.

float Unit::getMaxHitpoints   [inline]
 

Return number of maximum hitpoints.

Unit* Unit::getTarget  
 

Get enemy to which this Unit is attacking. NULL is returned if there is no enemy.

virtual Vector& Unit::getUnitPosition void   [pure virtual]
 

get unit position, implementation required in all units.

Reimplemented in UnitCommandCenter, and UnitMarine.

enum UnitTypes Unit::getUnitType   [inline]
 

Returns type of unit.

void Unit::increaseHitpoints float   amount [inline]
 

Increase amount of hitpoints by "amount".

bool Unit::isAlive   [inline]
 

Retruns true if unit is not dead.

bool Unit::isSelected   [inline]
 

Return true if unit is selected.

virtual int Unit::primaryAction Vector   destpos [inline, virtual]
 

execute primary action.

virtual int Unit::render   [pure virtual]
 

Reimplemented in UnitCommandCenter, and UnitMarine.

bool Unit::screenSelect Vector   sel1,
Vector   sel2
 

Select if unit is in selection area, sel1 and sel2 are 2d coordinates of selection rectangle corners.

void Unit::setHitpoints float   percent [inline]
 

Set amount of hitpoints. Percent if float between 0.0 and 1.0 where 1.0 is maximum amount of hitpoints and 0.0 kills unit.

void Unit::setMaxHitpoints float   maxpoints [inline, protected]
 

Set amount of maximum hitpoints.

virtual void Unit::setPrimaryAction int   actionnum [inline, virtual]
 

set primary action (right-click).

void Unit::setTarget int   player,
int   unitnum
 

Set enemy for this Unit. This enemy will be primary target.

void Unit::setTarget Unit *   enemy
 

Set enemy for this Unit. This enemy will be primary target.

virtual void Unit::setUnitPosition Vector   pos [pure virtual]
 

set position to pos, implementation required in all units.

Reimplemented in UnitCommandCenter, and UnitMarine.

void Unit::setUnitType enum UnitTypes   type [inline, protected]
 

Set unit type. Can be STATIC, BUILDING, BULLET, GROUND_UNIT or AIR_UNIT.

virtual int Unit::step   [pure virtual]
 

Reimplemented in UnitCommandCenter, and UnitMarine.


Member Data Documentation

bool Unit::bIsSelected [private]
 

float Unit::hitpoints [private]
 

float Unit::maxhitpoints [private]
 

int Unit::primaryActionNum [private]
 

Game* Unit::uGame [private]
 

Ground* Unit::uGround [private]
 

Player** Unit::uPlayers [private]
 

Renderer* Unit::uRenderer [private]
 

Unit* Unit::uTarget [private]
 

int Unit::uTargetNum [private]
 

int Unit::uTargetPlayer [private]
 

enum UnitTypes Unit::unittype [private]
 


The documentation for this class was generated from the following file:
Generated at Fri Oct 5 20:23:53 2001 for Executor by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001