public static ChunkSide OppositeSite(this ChunkSide side) { var si = (int)side; si = si % 2 == 0 ? si + 1 : si - 1; return((ChunkSide)si); }
private Vector3Int GetNeighbourPos(int cx, int cy, int cz, ChunkSide side) { switch (side) { case ChunkSide.Px: return(new Vector3Int(cx + 1, cy, cz)); case ChunkSide.Nx: return(new Vector3Int(cx - 1, cy, cz)); case ChunkSide.Py: return(new Vector3Int(cx, cy + 1, cz)); case ChunkSide.Ny: return(new Vector3Int(cx, cy - 1, cz)); case ChunkSide.Pz: return(new Vector3Int(cx, cy, cz + 1)); case ChunkSide.Nz: return(new Vector3Int(cx, cy, cz - 1)); default: throw new ArgumentOutOfRangeException(nameof(side), side, null); } }
public static ushort GetSizeBySide(ChunkSide side) { return((int)side < 2 ? XSize : ((int)side < 4 ? YSize : ZSize)); }