private void InteractWithCollider(Collider collider) { if (collider != null) { // Show Interaction Button if (!UIManager.Instance().IsPanelShow(UIPanelType.UIGameplayPromptwidgetPanel)) { UIManager.Instance().ShowPanel(UIPanelType.UIGameplayPromptwidgetPanel, new PromptWidgetDataProvider { m_interactiableObject = collider.gameObject }); InteractiveObject interativeObject = collider.GetComponent <InteractiveObject>(); string itemName = Error_Interactive_Object_Name; if (interativeObject) { itemName = interativeObject.GetUIDisplayName(); if (itemName == "") { itemName = Error_Interactive_Object_Name; } } EventManager.Instance.SendEvent(new CommonGamePlayPanelUpdateDataEvent { m_interactButtonShouldVisiable = true, m_itemName = itemName }); } // Do Interaction if (!UIManager.Instance().IsPanelShow(UIPanelType.UICommonTalkPanel)) { if (InputService.Instance.Input.PlayerControls.Interact.triggered || m_isInteractByUI) { m_isInteractByUI = false; Debug.Log("Did Interactive: " + collider.gameObject); collider.GetComponent <InteractiveObject>().Interact(); Debug.DrawRay(collider.transform.position, Vector3.up * 3, Color.yellow, 5.0f); } } } else { if (m_isInteractByUI) { if (UIManager.Instance().IsPanelShow(UIPanelType.UIGameplayPromptwidgetPanel)) { UIManager.Instance().HidePanel(UIPanelType.UIGameplayPromptwidgetPanel); } // Common gameplay may need to show others icon, which is only should make interact button invisiable. if (UIManager.Instance().IsPanelShow(UIPanelType.UICommonGameplayPanel)) { EventManager.Instance.SendEvent(new CommonGamePlayPanelUpdateDataEvent { m_interactButtonShouldVisiable = false }); } } m_isInteractByUI = false; } }