/// <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)); }
public void onClick(MapViewWindow source, Location loc, Point ab) { if (anchor == UNPLACED) { if (remover) { if (null == World.world[loc] as HalfDividedVoxel) { return; } } else { if (!HalfVoxelContribution.canBeBuilt(loc)) { return; } } anchor = loc; currentPos = loc; curSide = getSide(ab); sameLevelDisambiguator = new SameLevelDisambiguator(anchor.z); } else { if (!currentPos.Equals(anchor)) { onVoxelSelected(anchor, front, currentSide); } World.world.onVoxelUpdated(anchor); anchor = UNPLACED; } }