Exemple #1
0
    void Update()
    {
        if (currentInteractable != null)
        {
            if (IsMovementInputAllowed())
            {
                if (currentInteractable.GetInteractType() == E_InteractType.OnOverlap)
                {
                    OnItemInteractUI.SetActive(false);

                    return;
                }

                if (!currentInteractable.CanInteractWith())
                {
                    OnItemInteractUI.SetActive(false);
                    return;
                }

                currentInteractable.OnHover();
                OnItemInteractUI.SetActive(true);
            }
            else
            {
                if (!currentInteractable.CanInteractWith())
                {
                    OnItemInteractUI.SetActive(false);
                    return;
                }

                OnItemInteractUI.SetActive(false);
            }
        }
    }
Exemple #2
0
    private void StartInteracting(IInteractable interactable)
    {
        if (!interactable.CanInteractWith())
        {
            return;
        }

        if (currentInteractable != null)
        {
            StopInteracting();
        }

        currentInteractable = interactable;
        interactable.OnEnter();

        if (interactable.GetInteractType() == E_InteractType.OnOverlap)
        {
            return;
        }

        OnItemInteractUI.SetActive(true);
        if (emitterOutline == null)
        {
            SetupAudioEmitters();
        }
        emitterOutline.Play();
    }
Exemple #3
0
 // Start is called before the first frame update
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     SetActive(false);
 }
Exemple #4
0
 private void StopInteracting()
 {
     OnItemInteractUI.SetActive(false);
     currentInteractable.OnExit();
     currentInteractable = null;
 }