From 3dc89b8ff3d8693f80c7e3f7d79822a8f448ee95 Mon Sep 17 00:00:00 2001 From: Oscar Date: Sat, 16 Mar 2024 22:07:25 +0300 Subject: [PATCH] 12;3; --- Assets/Scripts/Characters/PersonController/Interactions.cs | 2 +- .../Scripts/Characters/PersonController/PersonController.cs | 5 +---- Assets/Scripts/Network/NetworkManagerUI.cs | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Characters/PersonController/Interactions.cs b/Assets/Scripts/Characters/PersonController/Interactions.cs index 4257611..7dcdcb2 100644 --- a/Assets/Scripts/Characters/PersonController/Interactions.cs +++ b/Assets/Scripts/Characters/PersonController/Interactions.cs @@ -261,7 +261,7 @@ public class Interactions : NetworkBehaviour _lightIntensity = Mathf.Lerp(_lightIntensity, (_gunSpread < Time.time) && (controller.currentEnergy >= controller.shootDepletion) ? 1f : 0f, Time.deltaTime * 5f); if (gunLayerWeight == 1) gun.SetActive(true); - if (gunRig.weight <= 0.1) gun.SetActive(false); + if (gunRig.weight <= 0.1 || controller.currentEnergy <= 0) gun.SetActive(false); if (gun != null) { diff --git a/Assets/Scripts/Characters/PersonController/PersonController.cs b/Assets/Scripts/Characters/PersonController/PersonController.cs index bf7457f..37ac40c 100644 --- a/Assets/Scripts/Characters/PersonController/PersonController.cs +++ b/Assets/Scripts/Characters/PersonController/PersonController.cs @@ -214,10 +214,7 @@ namespace StarterAssets { if (Input.GetKey(KeyCode.LeftShift) && _inputMove.magnitude != 0) { - if (currentEnergy > 0) - { - currentEnergy = Mathf.MoveTowards(currentEnergy, 0, _depletionSpeed * Time.deltaTime); - } + currentEnergy = Mathf.MoveTowards(currentEnergy, 0, _depletionSpeed * Time.deltaTime); } else if (currentEnergy <= _maxEnergy) { diff --git a/Assets/Scripts/Network/NetworkManagerUI.cs b/Assets/Scripts/Network/NetworkManagerUI.cs index 5f8f98c..f26c25c 100644 --- a/Assets/Scripts/Network/NetworkManagerUI.cs +++ b/Assets/Scripts/Network/NetworkManagerUI.cs @@ -8,7 +8,6 @@ using TMPro; public class NetworkManagerUI : MonoBehaviour { public NetworkManager manager; - public GameObject adressInputGO; public TMP_InputField adressInput; public TMP_InputField nicknameInput; public TMP_InputField MaxPlayersInput;