public static Position FromWorld(int x, int y, int depth) { var p = new Position(); p.localX = x % Constants.CHUNK_SIZE; p.localY = y % Constants.CHUNK_SIZE; p.depth = depth; p.chunkX = x / Constants.CHUNK_SIZE; p.chunkY = y / Constants.CHUNK_SIZE; p.worldX = x; p.worldY = y; p.genEncodedID(); return p; }
public static Position FromChunk(int cx, int cy, int depth) { var p = new Position(); p.localX = 0; p.localY = 0; p.depth = depth; p.chunkX = cx; p.chunkY = cy; p.worldX = cx * Constants.CHUNK_SIZE; p.worldY = cy * Constants.CHUNK_SIZE; p.genEncodedID(); return p; }