private Vector2 GetNextPositionAlong(Vector2 objPos, int direction) { //this method is completely changed to accomodate thedifferent way neighbours are found in hexagonal logic objPos = HexHelperHorizontal.offsetToAxial(objPos); //convert from offset to axial List <Vector2> neighbours = HexHelperHorizontal.getNeighbors(objPos); objPos = neighbours[direction]; //the neighbour list follows the same order sequence objPos = HexHelperHorizontal.axialToOffset(objPos); //convert back from axial to offset return(objPos); }
Vector2 GetScreenPointFromLevelIndices(int row, int col) { //converting indices to position values, col determines x & row determine y Vector2 tempPt = new Vector2(row, col); tempPt = HexHelperHorizontal.offsetToAxial(tempPt); //convert from offset to axial //convert axial point to screen point tempPt = HexHelperHorizontal.axialToScreen(tempPt, sideLength); tempPt.x -= middleOffset.x - Screen.width / 2; //add offsets for middle align tempPt.y *= -1; //unity y axis correction tempPt.y += middleOffset.y - Screen.height / 2; return(tempPt); }