public override void OnEnter() { if (setMenuDialog != null) { // Override the active menu dialog MenuDialog.activeMenuDialog = setMenuDialog; } bool hideOption = (hideIfVisited && targetBlock != null && targetBlock.GetExecutionCount() > 0); if (!hideOption) { IMenuDialog menuDialog = MenuDialog.GetMenuDialog(); if (menuDialog != null) { menuDialog.SetActive(true); var flowchart = GetFlowchart(); string displayText = flowchart.SubstituteVariables(text); menuDialog.AddOption(displayText, interactable, targetBlock); } } Continue(); }
public static IMenuDialog GetMenuDialog() { if (activeMenuDialog == null) { // Use first Menu Dialog found in the scene (if any) IMenuDialog md = GameObject.FindObjectOfType <MenuDialog>(); if (md != null) { activeMenuDialog = md; } if (activeMenuDialog == null) { // Auto spawn a menu dialog object from the prefab GameObject prefab = Resources.Load <GameObject>("Prefabs/MenuDialog"); if (prefab != null) { GameObject go = Instantiate(prefab) as GameObject; go.SetActive(false); go.name = "MenuDialog"; activeMenuDialog = go.GetComponent <IMenuDialog>(); } } } return(activeMenuDialog); }
public override void OnEnter() { IMenuDialog menuDialog = MenuDialog.GetMenuDialog(); if (menuDialog != null && targetBlock != null) { menuDialog.ShowTimer(_duration.Value, targetBlock); } Continue(); }