public class Unit
extends java.lang.Object
getUnitAt
from PP class.Modifier and Type | Method and Description |
---|---|
void |
command(int action,
float param)
Commands a unit to carry out an untargeted action.
|
void |
command(int action,
java.awt.geom.Point2D.Float target)
Commands a unit to carry out action on a specified position.
|
void |
command(int action,
Unit target)
Commands the unit to carry out action on a specified unit.
|
PP.Coalition |
getCoalition() |
int |
getGroup() |
float |
getHealth() |
int |
getId() |
float |
getMaxHealth() |
java.util.ArrayList<PendingCommand> |
getPendingCommands()
Returns pending commands of this unit.
|
java.awt.geom.Point2D.Float |
getPosition() |
int |
getType() |
void |
removeFromGroup()
Removes the unit from its group.
|
void |
setGroup(int g)
Allocates the unit to a specified group.
|
public int getId()
public PP.Coalition getCoalition() throws PPException
PPException
- on errors linked with Prog&Play.public int getType() throws PPException
PPException
- on errors linked with Prog&Play.public java.awt.geom.Point2D.Float getPosition() throws PPException, java.lang.InstantiationException
PPException
- on errors linked with Prog&Play.java.lang.InstantiationException
- on allocation problem.public float getHealth() throws PPException
PPException
- on errors linked with Prog&Play.public float getMaxHealth() throws PPException
PPException
- on errors linked with Prog&Play.public int getGroup() throws PPException
PPException
- on errors linked with Prog&Play.public void setGroup(int g) throws PPException
g
- allocation group (g >= 0
).PPException
- on errors linked with Prog&Play.public void removeFromGroup() throws PPException
PPException
- on errors linked with Prog&Play.public java.util.ArrayList<PendingCommand> getPendingCommands() throws PPException
PPException
- on errors linked with Prog&Play.public void command(int action, Unit target) throws PPException
action
- action to carry out.target
- target unit.PPException
- on errors linked with Prog&Play.public void command(int action, java.awt.geom.Point2D.Float target) throws PPException
action
- action to carry out.target
- target position.PPException
- on errors linked with Prog&Play.public void command(int action, float param) throws PPException
action
- action to carry out.param
- parameter to the action. If any parameter required, put -1.0
instead.PPException
- on errors linked with Prog&Play.