protected virtual void InteractPerformed(InputAction.CallbackContext obj) { if (characterDialogue.GetDialogueState() != DialogueState.Disabled) { characterDialogue.NextState(); } else { if (ObjectInRange != null) { characterInteraction.InteractWithObject(ObjectInRange); } } }
public void Interact() { if (_characterDialogue == null) { _characterDialogue = gameObject.AddComponent <CharacterDialogue>() as CharacterDialogue; } if (_characterDialogue.GetDialogueState() != DialogueState.Disabled) { _characterDialogue.NextState(); } else { RaycastHit objectInRange; if (Physics.Raycast(transform.position, _characterPhysicalObject.transform.forward, out objectInRange, _interactionRange)) { if (objectInRange.collider.gameObject.GetComponent <InteractableObject>()) { _characterInteraction.InteractWithObject(objectInRange.collider.gameObject.GetComponent <InteractableObject>()); } } } }