Ejemplo n.º 1
0
 protected virtual void InteractPerformed(InputAction.CallbackContext obj)
 {
     if (characterDialogue.GetDialogueState() != DialogueState.Disabled)
     {
         characterDialogue.NextState();
     }
     else
     {
         if (ObjectInRange != null)
         {
             characterInteraction.InteractWithObject(ObjectInRange);
         }
     }
 }
Ejemplo n.º 2
0
    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>());
                }
            }
        }
    }
Ejemplo n.º 3
0
 public void OnMouseDown()
 {
     _characterDialogue.NextState();
 }