#include <unit.h>
Inheritance diagram for Unit::
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 Vector & | getUnitPosition (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 | |
Renderer * | uRenderer |
Game * | uGame |
Ground * | uGround |
Player ** | uPlayers |
int | primaryActionNum |
bool | bIsSelected |
Unit * | uTarget |
int | uTargetNum |
int | uTargetPlayer |
float | maxhitpoints |
float | hitpoints |
enum UnitTypes | unittype |
|
|
|
|
|
Set orders for unit, implementation required in all units.
Reimplemented in UnitCommandCenter, and UnitMarine. |
|
Reduce amount of hitpoints by "amount".
|
|
Return number of hitpoints.
|
|
Return number of maximum hitpoints.
|
|
Get enemy to which this Unit is attacking. NULL is returned if there is no enemy.
|
|
get unit position, implementation required in all units.
Reimplemented in UnitCommandCenter, and UnitMarine. |
|
Returns type of unit.
|
|
Increase amount of hitpoints by "amount".
|
|
Retruns true if unit is not dead.
|
|
Return true if unit is selected.
|
|
execute primary action.
|
|
Reimplemented in UnitCommandCenter, and UnitMarine. |
|
Select if unit is in selection area, sel1 and sel2 are 2d coordinates of selection rectangle corners.
|
|
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.
|
|
Set amount of maximum hitpoints.
|
|
set primary action (right-click).
|
|
Set enemy for this Unit. This enemy will be primary target.
|
|
Set enemy for this Unit. This enemy will be primary target.
|
|
set position to pos, implementation required in all units.
Reimplemented in UnitCommandCenter, and UnitMarine. |
|
Set unit type. Can be STATIC, BUILDING, BULLET, GROUND_UNIT or AIR_UNIT.
|
|
Reimplemented in UnitCommandCenter, and UnitMarine. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|