public override void UpdateBehaviour() { base.UpdateBehaviour(); hoverInteractable = null; Collider[] overlaps = Physics.OverlapSphere(_interactionPoint.position, _interactionPoint.localScale.x, (1 << LayerMask.NameToLayer("Ground")) | (1 << LayerMask.NameToLayer("Actor"))); List <Interactable> interactables = new List <Interactable>(); foreach (Collider overlap in overlaps) { Interactable interactable = overlap.GetComponent <Interactable>(); if (interactable != null && interactable.CanInteract(actor)) { interactables.Add(interactable); } } if (interactables.Count > 0) { interactables.Sort((x, y) => Vector3.Distance(_interactionPoint.position, x.transform.position).CompareTo(Vector3.Distance(_interactionPoint.position, y.transform.position))); hoverInteractable = interactables[0]; } if (CanInteract()) { if (_input != null) { if (_input.isInteract && !_conversation.conversing)//_input.inputSystem_Character.interact.onDown) { _input.ToggleActionMap("gamemenu"); StartInteraction(hoverInteractable); } } } }
public virtual void StopConversation() { if (conversing) { stopConversationEvent.Invoke(_currentConversation); _currentConversation.conversationActionEvent.RemoveListener(ConversationActionReceived); if (_input != null) { _input.DisableCharacterInputForFrames(2); _input.ToggleActionMap("gameplay"); } } _currentConversation = null; }