Guest User

Untitled

a guest
Oct 11th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. private void CheckAdjacentCubes(List<Cube> cubes, List<Cube> cubeToDraw)
  2. {
  3. //cubes is main list of cubes
  4. //cubeToDraw is the list of cubes to draw after adjacency check
  5.  
  6. foreach (Cube cube in cubes)
  7. {
  8. foreach (Cube adjacentCube in cubes)
  9. {
  10. if (cube.World.Translation.Z + 0.5f == adjacentCube.World.Translation.Z - 0.5f)
  11. {
  12. backSide = true;
  13. }
  14. if (cube.World.Translation.Z - 0.5f == adjacentCube.World.Translation.Z + 0.5f)
  15. {
  16. frontSide = true;
  17. }
  18. if (cube.World.Translation.X + 0.5f == adjacentCube.World.Translation.X - 0.5f)
  19. {
  20. rightSide = true;
  21. }
  22. if (cube.World.Translation.X - 0.5f == adjacentCube.World.Translation.X + 0.5f)
  23. {
  24. leftSide = true;
  25. }
  26. if (cube.World.Translation.Y + 0.5f == adjacentCube.World.Translation.Y - 0.5f)
  27. {
  28. topSide = true;
  29. }
  30. if (cube.World.Translation.Y - 0.5f == adjacentCube.World.Translation.Y + 0.5f)
  31. {
  32. bottomSide = true;
  33. }
  34. }
  35.  
  36. if (bottomSide != true || topSide != true || leftSide != true || rightSide != true || frontSide != true || backSide != true)
  37. {
  38. cubeToDraw.Add(cube);
  39. }
  40.  
  41. bottomSide = false;
  42. topSide = false;
  43. leftSide = false;
  44. rightSide = false;
  45. frontSide = false;
  46. backSide = false;
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment