Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. void RotateSon()
  2. {
  3. if (CheckGrid(0, -1) && CheckGrid(0, 1))
  4. {
  5. return;
  6. }
  7.  
  8. else if (sonActualPos == SonPosition.up)
  9. {
  10. sonActualPos = SonPosition.right;
  11.  
  12. if(CheckGrid(0,1))
  13. {
  14. RotateSon();
  15. return;
  16. }
  17.  
  18. son.transform.localPosition = Vector3.right;
  19.  
  20. ChangeLimits(2, 1, 1);
  21.  
  22. }
  23.  
  24. else if (sonActualPos == SonPosition.right)
  25. {
  26. sonActualPos = SonPosition.down;
  27.  
  28. if (CheckGrid(-1, 0))
  29. {
  30. RotateSon();
  31. return;
  32. }
  33.  
  34. son.transform.localPosition = Vector3.down;
  35.  
  36. ChangeLimits(1, 1, 2);
  37.  
  38. }
  39.  
  40. else if (sonActualPos == SonPosition.down)
  41. {
  42. sonActualPos = SonPosition.left;
  43.  
  44. if (CheckGrid(0, -1))
  45. {
  46. RotateSon();
  47. return;
  48. }
  49.  
  50. son.transform.localPosition = Vector3.left;
  51.  
  52. ChangeLimits(1, 2, 1);
  53.  
  54. }
  55.  
  56. else
  57. {
  58. sonActualPos = SonPosition.up;
  59.  
  60. son.transform.localPosition = Vector3.up;
  61.  
  62. ChangeLimits(1, 1, 1);
  63.  
  64. }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement