|
|
@ -5,7 +5,6 @@ using UnityEditor; |
|
|
using UnityEngine; |
|
|
using UnityEngine; |
|
|
using UnityEngine.EventSystems; |
|
|
using UnityEngine.EventSystems; |
|
|
using UnityEngine.UI; |
|
|
using UnityEngine.UI; |
|
|
using static UnityEditor.Progress; |
|
|
|
|
|
|
|
|
|
|
|
public class InteractionManager : MonoBehaviour |
|
|
public class InteractionManager : MonoBehaviour |
|
|
{ |
|
|
{ |
|
|
@ -20,6 +19,7 @@ public class InteractionManager : MonoBehaviour |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[SerializeField] private Player localPlayer; |
|
|
[SerializeField] private Player localPlayer; |
|
|
|
|
|
[SerializeField] private CameraController cameraController; |
|
|
|
|
|
|
|
|
[Header("Layers")] |
|
|
[Header("Layers")] |
|
|
[SerializeField] private LayerMask clickableLayers; |
|
|
[SerializeField] private LayerMask clickableLayers; |
|
|
@ -29,7 +29,6 @@ public class InteractionManager : MonoBehaviour |
|
|
[Header("Interaction")] |
|
|
[Header("Interaction")] |
|
|
[SerializeField] private List<string> blockReasons; |
|
|
[SerializeField] private List<string> blockReasons; |
|
|
[SerializeField, ReadOnly] private bool active; |
|
|
[SerializeField, ReadOnly] private bool active; |
|
|
[SerializeField, ReadOnly] private Item item; |
|
|
|
|
|
[SerializeField, ReadOnly] private Interactable interactable; |
|
|
[SerializeField, ReadOnly] private Interactable interactable; |
|
|
|
|
|
|
|
|
public static Interactable Interactable => Instance.interactable; |
|
|
public static Interactable Interactable => Instance.interactable; |
|
|
@ -131,7 +130,6 @@ public class InteractionManager : MonoBehaviour |
|
|
{ |
|
|
{ |
|
|
this.interactable = interactable; |
|
|
this.interactable = interactable; |
|
|
SetActive(true); |
|
|
SetActive(true); |
|
|
//Player.Instance.LookAt(interactive.transform.position);
|
|
|
|
|
|
localPlayer.Movement.StopMovement(); |
|
|
localPlayer.Movement.StopMovement(); |
|
|
interactable.CreateInteractions(); |
|
|
interactable.CreateInteractions(); |
|
|
} |
|
|
} |
|
|
@ -146,12 +144,21 @@ public class InteractionManager : MonoBehaviour |
|
|
|
|
|
|
|
|
public void SetLocalPlayer(Player player) |
|
|
public void SetLocalPlayer(Player player) |
|
|
{ |
|
|
{ |
|
|
if (!player.IsMine) |
|
|
if (!player.IsOwner) |
|
|
{ |
|
|
{ |
|
|
Debug.LogError("Trying to assign not owned player"); |
|
|
Debug.LogError("Trying to assign not owned player"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
localPlayer = player; |
|
|
localPlayer = player; |
|
|
|
|
|
cameraController.SetTarget(player.transform); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void InteractTest() |
|
|
|
|
|
{ |
|
|
|
|
|
if (interactable) |
|
|
|
|
|
{ |
|
|
|
|
|
interactable.Interactions[0].Action(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|