From f55347127853862bc0b1d53414ecf70d5fab45e0 Mon Sep 17 00:00:00 2001 From: sebastianhampel1 Date: Thu, 15 Jun 2023 12:03:19 -0400 Subject: [PATCH] Update PlayerInteractionHandler.cs --- .../Player/PlayerInteractionHandler.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Player/PlayerInteractionHandler.cs b/Assets/Scripts/Player/PlayerInteractionHandler.cs index b0f9c6f..e386411 100644 --- a/Assets/Scripts/Player/PlayerInteractionHandler.cs +++ b/Assets/Scripts/Player/PlayerInteractionHandler.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; using UnityEngine; +using FishNet.Connection; +using FishNet.Object; namespace Player { [RequireComponent(typeof(Collider))] -public class PlayerInteractionHandler : MonoBehaviour +public class PlayerInteractionHandler : NetworkBehaviour { public static PlayerInteractionHandler instance; @@ -27,6 +29,7 @@ public class PlayerInteractionHandler : MonoBehaviour public bool isDead; + //Check if button down private readonly AxisIsDown fireDown = new("Fire1"); private bool flashlightEnabled = true; @@ -48,8 +51,17 @@ public class PlayerInteractionHandler : MonoBehaviour public Transform CarryingPos => carryingPos; - // Start is called before the first frame update - private void Start() + public override void OnStartClient() + { + base.OnStartClient(); + if (!base.IsOwner) + { + this.enabled = false; + } + } + + // Start is called before the first frame update + private void Start() { instance = this; invent = transform.parent.GetComponent(); @@ -61,6 +73,7 @@ public class PlayerInteractionHandler : MonoBehaviour itemSelector = Item.ItemSelector.instance; pistol.gameObject.SetActive(GunEnabled); flashlightEnabled = flashlight.gameObject.activeSelf; + shift = GameObject.Find("CameraHidden").GetComponent(); }