use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class GridCellContainer method init.
@Override
public GridCellContainer init() {
super.init();
graveyard = new GraveyardView();
addActor(graveyard);
graveyard.setWidth(getWidth());
graveyard.setHeight(getHeight());
setUserObject(new GridCellDataSource(new Coordinates(getGridX(), getGridY())));
return this;
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class PositionMaster method getClosestCoordinate.
public static Coordinates getClosestCoordinate(Coordinates source_coordinates, List<Obj> objects) {
int distance = Integer.MAX_VALUE;
Coordinates coordinates = null;
for (Obj obj : objects) {
if (distance > getDistance(source_coordinates, obj.getCoordinates())) {
distance = getDistance(source_coordinates, obj.getCoordinates());
coordinates = obj.getCoordinates();
}
}
return coordinates;
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class DefaultActionHandler method leftClickCell.
public static boolean leftClickCell(boolean turn, boolean moveTo, int gridX, int gridY) {
Unit source = null;
try {
source = Eidolons.getGame().getManager().getActiveObj();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
if (source == null)
return false;
if (source.isAiControlled())
return false;
Coordinates c = new Coordinates(gridX, gridY);
if (turn) {
return turnToMotion(source, c);
}
if (moveTo) {
return moveToMotion(source, c);
}
if (source.getGame().isDebugMode()) {
return doDebugStuffCell(source, c);
}
if (c.x - source.getX() > 1) {
return false;
}
if (c.y - source.getY() > 1) {
return false;
}
DC_UnitAction action = getMoveToCellAction(source, c);
if (action == null) {
return false;
}
Obj target = action.getTargeting() instanceof SelectiveTargeting ? Eidolons.getGame().getCellByCoordinate(c) : null;
Context context = new Context(source, target);
return activate(context, action);
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class MiniGrid method getCompByPoint.
public MiniObjComp getCompByPoint(Point p) {
int x = p.x / getCellWidth();
int y = p.y / getCellWidth();
Coordinates coordinates = new Coordinates(true, x, y);
// preCheck overlaying!
for (MiniObjComp o : overlayingObjComps) {
// if (!o.getCoordinates().eq)
// continue; TODO
((Unit) o.getObj()).getDirection();
o.getCellSize();
getOverlayingObjWidth();
}
return compMap.get(coordinates);
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class MiniGrid method refresh.
@Override
public void refresh() {
Chronos.mark("minigrid refresh");
Set<Coordinates> set = compMap.keySet();
int index = 0;
for (MiniObjComp comp : overlayingObjComps) {
comp.refresh();
this.comp.setComponentZOrder(comp.getComp(), index);
index++;
}
for (Coordinates c : set) {
refreshComp(index, c);
index++;
}
comp.revalidate();
// Chronos.logTimeElapsedForMark("minigrid refresh");
}
Aggregations