From db50852ac9275fe7ef7734d05ddbfa47ad6a2618 Mon Sep 17 00:00:00 2001 From: sebastianhampel1 Date: Thu, 15 Jun 2023 12:19:21 -0400 Subject: [PATCH] Update PlayerInteractionHandler.cs --- Assets/Scripts/Player/PlayerInteractionHandler.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Assets/Scripts/Player/PlayerInteractionHandler.cs b/Assets/Scripts/Player/PlayerInteractionHandler.cs index 8f670f5..a3ff2f1 100644 --- a/Assets/Scripts/Player/PlayerInteractionHandler.cs +++ b/Assets/Scripts/Player/PlayerInteractionHandler.cs @@ -76,6 +76,16 @@ public class PlayerInteractionHandler : NetworkBehaviour shift = GameObject.Find("CameraHidden").GetComponent(); } + [ServerRpc] + public void SwitchWeaponMode() + { + GunEnabled = !GunEnabled; + if (!GunEnabled) + pistol.Disable(); + pistol.gameObject.SetActive(GunEnabled); + if (GunEnabled) + pistol.Enable(); + } // Update is called once per frame private void Update() @@ -188,6 +198,7 @@ public class PlayerInteractionHandler : NetworkBehaviour if (Input.GetButtonDown("Fire3")&&inputEnbaled) if (!IsCarrying) { + SwitchWeaponMode(); GunEnabled = !GunEnabled; if (!GunEnabled) pistol.Disable();