From 95532a18393e14d34ecbd7ebab0c738eb1b05727 Mon Sep 17 00:00:00 2001 From: Vladislav Likhenko Date: Mon, 12 Aug 2024 13:44:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=20=D1=88=D1=80=D0=B8=D1=84?= =?UTF-8?q?=D1=82=D0=BE=D0=B2,=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BB=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=20?= =?UTF-8?q?=D0=B8=D0=BD=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Racing_Game/Scence/Main/Main.unity | Bin 527376 -> 527376 bytes .../MainUI/Scripts/TimerOnInactiveScript.cs | 37 ++++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Assets/Racing_Game/Scence/Main/Main.unity b/Assets/Racing_Game/Scence/Main/Main.unity index bd48c2f68c92b2668432ee3f45cbccca08b19613..e54c68823fc7c8be58a33863cc7e65c628db0ab0 100644 GIT binary patch delta 434 zcmbO*Lt(-Ug@zW!Elg^8+y@*P7!Ej2U}Rum*lw7|#L9sp;#kJCyo48|0-@^bE2eBM zRI%wmo!_VT2s3kR&kOjFX5dvvk6Jn*H=v0 zTD-=_$w09Kj$obBfjYlW?-6F^*q$TCZ1fh{43OOK>1P;OIJU20VTs@a>SRRd+%720 zvb&P^>={mk7(~aLE*6gVJH0I1@AR^!WC2xNb40U`=R2#w^gpke47RuYWWA6HR5Amh zWP4&V+jbV9Wfu`*U}tWZ$z(I(^j`o+_dHa`xy;vw$^ZQOko57WPgS^ 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()