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); } } }
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(); }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; } SetActive(false); }
private void StopInteracting() { OnItemInteractUI.SetActive(false); currentInteractable.OnExit(); currentInteractable = null; }