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(); }