gecco.game.dke
Class MoveAction
java.lang.Object
gecco.server.core.Action
gecco.game.dke.MoveAction
- Direct Known Subclasses:
- MarchAction
- public class MoveAction
- extends Action
Method Summary |
void |
calcAddXAddY(double _argX,
double _argY)
|
void |
calcAddXAddY(double _argX,
double _argY,
double stepLength)
|
ActionReturn |
checkPoint()
This method is called periodically by the game engine. |
void |
expandVisitedToRouteWidth(int x,
int y,
int direction)
If unit moves along a road i x-directon, expand visited automatons i y-directon
and vice versa. |
AutomatonImpl |
getAutomatonImpl(int x,
int y)
|
WarUnit |
getWarUnit()
|
void |
initiate(int _actionHandle,
int _unitHandle,
double _argX,
double _argY)
Initialise the action with a point as argument. |
boolean |
isCloseEnough(double destX,
double destY)
|
void |
markAsVisited(int x,
int y)
|
void |
prepareAbortion()
Called from ActionProcessor when Action is aborted,
lets Action abort gracefully |
void |
testUpdateVisited()
|
void |
updateUnitStatus(boolean b)
|
boolean |
updateUpdateVisited()
|
Methods inherited from class gecco.server.core.Action |
canSeePosition, getActionDefinition, getActionHandle, getArgumentUnit, getArgumentX, getArgumentY, getAutomatonState, getCooperativeUnits, getId, getNewActionHandle, getUnit, getUnitHandle, initiate, initiate, initiate, isInstantaneous, isOutsideMap, sendEventToAutomaton, sendEventToUnit, setActionDefinition, setArgumentUnit, setArgumentX, setArgumentY, setInstantaneous |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MoveAction
public MoveAction()
initiate
public void initiate(int _actionHandle,
int _unitHandle,
double _argX,
double _argY)
- Description copied from class:
Action
- Initialise the action with a point as argument.
- Overrides:
initiate
in class Action
- Parameters:
_actionHandle
- A unique handle that should identify this action._unitHandle
- The handle of the executing unit._argX
- The x coordinate of the target point._argY
- The y coordinate of the target point.
calcAddXAddY
public void calcAddXAddY(double _argX,
double _argY)
calcAddXAddY
public void calcAddXAddY(double _argX,
double _argY,
double stepLength)
isCloseEnough
public boolean isCloseEnough(double destX,
double destY)
getWarUnit
public WarUnit getWarUnit()
getAutomatonImpl
public AutomatonImpl getAutomatonImpl(int x,
int y)
updateUpdateVisited
public boolean updateUpdateVisited()
testUpdateVisited
public void testUpdateVisited()
markAsVisited
public void markAsVisited(int x,
int y)
expandVisitedToRouteWidth
public void expandVisitedToRouteWidth(int x,
int y,
int direction)
- If unit moves along a road i x-directon, expand visited automatons i y-directon
and vice versa. Max expantion is set to Def.getMaxRoadWidth() in both directions.
- Parameters:
x
- an int
valuey
- an int
valuedirection
- an int
, 0 expand in X direction anyting else
expand in Y direction
checkPoint
public ActionReturn checkPoint()
- Description copied from class:
Action
- This method is called periodically by the game engine.
- Specified by:
checkPoint
in class Action
- Returns:
- An object of type ActionReturn, which encapsulates data about
the status of the action after the checkpoint. Different instances
of the class ActionReturn should be returned depending on whether
the action is completed, aborted, or if the action should be
requeued and the checkpoint method called again at some time later.
updateUnitStatus
public void updateUnitStatus(boolean b)
prepareAbortion
public void prepareAbortion()
- Description copied from class:
Action
- Called from ActionProcessor when Action is aborted,
lets Action abort gracefully
- Overrides:
prepareAbortion
in class Action