/// <summary> /// Converts the (A,B) coordinates to (X,Y,Z) coordinates. /// </summary> public Location fromABToXYZ(int a, int b, ModalController controller) { int t = 2 * b - 16; int x = (a - t) >> 5; int y = (a + t) >> 5; x += (world.size.y - 1) / 2; // (x,y,0) is the base location. disambiguate the location. // TODO: use height-cut here to force the specified z-level if (controller != null) { LocationDisambiguator disambiguator = controller.disambiguator; for (int z = heightCutHeight; z >= 0; z--) { Location loc = new Location(x - z, y + z, z); if (disambiguator.isSelectable(loc)) { return(loc); } } } return(new Location(x, y, 0)); }