use of spacesettlers.graphics.CircleGraphics in project spacesettlers by amymcgovern.
the class RandomTeamClient method getMovementStart.
@Override
public Map<UUID, AbstractAction> getMovementStart(Toroidal2DPhysics space, Set<AbstractActionableObject> actionableObjects) {
HashMap<UUID, AbstractAction> randomActions = new HashMap<UUID, AbstractAction>();
for (AbstractObject actionable : actionableObjects) {
if (actionable instanceof Ship) {
Ship ship = (Ship) actionable;
AbstractAction current = ship.getCurrentAction();
// if we finished, make a new spot in space to aim for
if (current == null || current.isMovementFinished(space)) {
Position currentPosition = ship.getPosition();
Position newGoal = space.getRandomFreeLocationInRegion(random, Ship.SHIP_RADIUS, (int) currentPosition.getX(), (int) currentPosition.getY(), RANDOM_MOVE_RADIUS);
MoveAction newAction = null;
newAction = new MoveAction(space, currentPosition, newGoal);
// System.out.println("Ship is at " + currentPosition + " and goal is " + newGoal);
SpacewarGraphics graphic = new CircleGraphics(1, getTeamColor(), newGoal);
graphics.add(graphic);
// Vector2D shortVec = space.findShortestDistanceVector(currentPosition, newGoal);
// LineShadow lineShadow = new LineShadow(currentPosition, newGoal, shortVec);
// newShadows.add(lineShadow);
randomActions.put(ship.getId(), newAction);
} else {
randomActions.put(ship.getId(), ship.getCurrentAction());
}
} else {
// it is a base and random doesn't do anything to bases
randomActions.put(actionable.getId(), new DoNothingAction());
}
}
return randomActions;
}
Aggregations