private IEnumerable <CubePosition> GetNeighbors(CubePosition cubePosition, CubePosition flyLight, bool includeW) { int cubeX = cubePosition.X; int cubeY = cubePosition.Y; int cubeZ = cubePosition.Z; int cubeW = cubePosition.W; for (int x = cubeX - 1; x <= cubeX + 1; x++) { flyLight.X = x; for (int y = cubeY - 1; y <= cubeY + 1; y++) { flyLight.Y = y; for (int z = cubeZ - 1; z <= cubeZ + 1; z++) { flyLight.Z = z; for (int w = cubeW - 1; w <= cubeW + 1; w++) { if (includeW) { flyLight.W = w; } yield return(flyLight); if (!includeW) { break; } } } } } }
protected bool Equals(CubePosition other) { return(X == other.X && Y == other.Y && Z == other.Z && W == other.W); }