Update PlayerInteractionHandler.cs

This commit is contained in:
sebastianhampel1 2023-06-15 12:19:21 -04:00
parent 990d992276
commit db50852ac9

View File

@ -76,6 +76,16 @@ public class PlayerInteractionHandler : NetworkBehaviour
shift = GameObject.Find("CameraHidden").GetComponent<CameraShift>();
}
[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();