void OnMouseDown() { if (!m_decided && !s_IsScreenOpen) { m_screenInstance = GameObject.Instantiate(m_screen); m_ui = m_screenInstance.GetComponent <ShittrUI>(); m_ui.OnAccepted += OnUIAccepted; m_ui.OnRejected += OnUIRejected; m_decided = true; s_IsScreenOpen = true; } }
private void CloseScreen() { if (m_screenInstance == null) { return; } m_ui.OnAccepted -= OnUIAccepted; m_ui.OnRejected -= OnUIRejected; m_ui = null; Destroy(m_screenInstance); m_screenInstance = null; s_IsScreenOpen = false; }