public T ShowMenu <T>(T prefab) where T : PhxMenuInterface { if (CurrentMenu != null) { RemoveMenu(false); } CurrentMenu = Instantiate(prefab.gameObject).GetComponent <PhxMenuInterface>(); return((T)CurrentMenu); }
void RemoveMenu(bool bInvokeEvent) { if (CurrentMenu != null) { Type menuType = CurrentMenu.GetType(); CurrentMenu.Clear(); Destroy(CurrentMenu.gameObject); CurrentMenu = null; if (bInvokeEvent) { OnRemoveMenu?.Invoke(menuType); } } }
public bool IsMenuActive(PhxMenuInterface prefab) { Debug.Assert(prefab != null); return(CurrentMenu == null ? false : CurrentMenu.GetType() == prefab.GetType()); }