// Add a new step from {xorigin,yorigin} to {xdest,ydest} public void addStep(int xorigin, int yorigin, int xdest, int ydest) { if (currentIter < maxIter) { hexPath[currentIter] = map.getHexAt(xdest, ydest); addMovementCost(HexMapper.getMoveCost(map.getHexAt(xorigin, yorigin), map.getHexAt(xdest, ydest))); currentIter++; hexSteps++; } }
// Obtain global coordinates if xglobal & yglobal have been set public xyz[] getGlobalVertices() { xyz[] xyzs = new xyz[7]; if (xglobal != -1 & yglobal != -1) { // Global info available, mapping each vertex shifted by corresponding tile origo xyzs = HexMapper.createGlobalHexVertexCoord(xglobal, yglobal); } else { // No global info provided, using local coordinates instead as if located at {0,0} in tile map xyzs = this.getVertices(); } return(xyzs); }
public void setGlobalCoord(int x, int y) { this.xglobal = x; this.yglobal = y; this.vertices = HexMapper.createGlobalHexVertexCoord(x, y); }