Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1. private void PlayersInputManagement()
  2. {
  3. // Игра стоит на паузе: ничего не обрабатываем.
  4. if (Time.timeScale == 0)
  5. {
  6. return;
  7. }
  8.  
  9. playerManager.ResetPlayersButtonsOnThisFrame();
  10.  
  11. // Отлавливаем нажатия кнопок перемещения:
  12. // A и D дают смещение по оси X, W и S по оси Z.
  13. // Обращение к клавишам через названия присвоенных им действий в
  14. // Input Manager самой Unity. 1 - клавиша нажата, 0 -нет;
  15. // значение "-1" появляется у клавиш для ходьбы.
  16.  
  17. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода не нужен.
  18. if (Input.GetAxisRaw("Horizontal go") != 0 && Input.GetAxisRaw("Vertical go") != 0)
  19. {
  20. if (Input.GetAxisRaw("Horizontal go") == 1 && Input.GetAxisRaw("Vertical go") == 1)
  21. {
  22. playerManager.directionByXProperty = 1;
  23. playerManager.movementByHorizontalProperty = true;
  24. }
  25. else if (Input.GetAxisRaw("Horizontal go") == -1 && Input.GetAxisRaw("Vertical go") == -1)
  26. {
  27. playerManager.directionByXProperty = -1;
  28. playerManager.movementByHorizontalProperty = true;
  29. }
  30. else if (Input.GetAxisRaw("Horizontal go") == -1 && Input.GetAxisRaw("Vertical go") == 1)
  31. {
  32. playerManager.directionByZProperty = 1;
  33. playerManager.movementByVerticalProperty = true;
  34. }
  35. else if (Input.GetAxisRaw("Horizontal go") == 1 && Input.GetAxisRaw("Vertical go") == -1)
  36. {
  37. playerManager.directionByZProperty = -1;
  38. playerManager.movementByVerticalProperty = true;
  39. }
  40. }
  41. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода Выше не нужен.
  42. else if (Input.GetAxisRaw("Horizontal go") == 1)
  43. {
  44. playerManager.directionByXProperty = 1;
  45. playerManager.movementByHorizontalProperty = true;
  46.  
  47. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода не нужен.
  48. playerManager.directionByZProperty = -1;
  49. playerManager.movementByVerticalProperty = true;
  50. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода Выше не нужен.
  51. }
  52. else if (Input.GetAxisRaw("Horizontal go") == -1)
  53. {
  54. playerManager.directionByXProperty = -1;
  55. playerManager.movementByHorizontalProperty = true;
  56.  
  57. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода не нужен.
  58. playerManager.directionByZProperty = 1;
  59. playerManager.movementByVerticalProperty = true;
  60. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода Выше не нужен.
  61. }
  62. else if (Input.GetAxisRaw("Vertical go") == 1)
  63. {
  64. playerManager.directionByZProperty = 1;
  65. playerManager.movementByVerticalProperty = true;
  66.  
  67. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода не нужен.
  68. playerManager.directionByXProperty = 1;
  69. playerManager.movementByHorizontalProperty = true;
  70. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода Выше не нужен.
  71. }
  72. else if (Input.GetAxisRaw("Vertical go") == -1)
  73. {
  74. playerManager.directionByZProperty = -1;
  75. playerManager.movementByVerticalProperty = true;
  76.  
  77. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода не нужен.
  78. playerManager.directionByXProperty = -1;
  79. playerManager.movementByHorizontalProperty = true;
  80. // Если настройки ротейшена камеры 60,45,0; в ином случае этот кусок кода Выше не нужен.
  81. }
  82.  
  83. // Действия мышью: ЛКМ и ПКМ.
  84. if (Input.GetButton("Left mouse"))
  85. {
  86. player.UseModificator();
  87. }
  88. else if (Input.GetButton("Right mouse"))
  89. {
  90. playerManager.skillWasPressedProperty = true;
  91. }
  92.  
  93. playerManager.ExecutePlayersActions();
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement