diff --git a/Assets/Racing_Game/Scence/Main/Main.unity b/Assets/Racing_Game/Scence/Main/Main.unity index bd48c2f6..e54c6882 100644 Binary files a/Assets/Racing_Game/Scence/Main/Main.unity and b/Assets/Racing_Game/Scence/Main/Main.unity differ diff --git a/Assets/Racing_Game/UI/MainUI/Scripts/TimerOnInactiveScript.cs b/Assets/Racing_Game/UI/MainUI/Scripts/TimerOnInactiveScript.cs index eade3305..cdf1bafb 100644 --- a/Assets/Racing_Game/UI/MainUI/Scripts/TimerOnInactiveScript.cs +++ b/Assets/Racing_Game/UI/MainUI/Scripts/TimerOnInactiveScript.cs @@ -1,5 +1,6 @@ using UnityEngine; using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Controls; public class TimerOnInactiveScript : MonoBehaviour { @@ -28,23 +29,37 @@ public class TimerOnInactiveScript : MonoBehaviour MoveCameraToRound(); } - InputSystem.onActionChange += (obj, change) => + /// + /// Отслеживание взаимодействия ввода-вывода + /// + //-------------------------------------------------------------------------------------------- + + foreach (var control in Gamepad.current.allControls) { - if (change == InputActionChange.ActionPerformed) + if (control is ButtonControl button && button.wasPressedThisFrame) { ResetTimer(); MoveCameraFromRound(); } - }; - //ResetTimer(); - //MoveCameraFromRound(); - //if (Gamepad.current.) - //{ - // //Debug.Log("кнопка нажата"); - // ResetTimer(); - // MoveCameraFromRound(); - //} + if (control is AxisControl axis) + { + float value = axis.ReadValue(); + if (Mathf.Abs(value) > 0.1f) // Игнорируем малые изменения + { + ResetTimer(); + MoveCameraFromRound(); + } + } + } + + if (Keyboard.current.wasUpdatedThisFrame) + { + ResetTimer(); + MoveCameraFromRound(); + } + + //-------------------------------------------------------------------------------------------- } void MoveCameraToRound()