/// <summary>Shows the given <see cref="BlockGrid"/>'s terminal.</summary> public void ShowTerminal(BlockGrid grid) { //Setup AllSetup = false; foreach (Block block in grid) { if (block is IBlockTerminal terminal) { foreach (TerminalMenu menu in terminal.Menus) { menu.block = block; var window = Master.prefabs.terminal.Instantiate(Canvas.gameObject.transform); menu.Manager = window; window.component.Manager = this; window.component.menu = menu; TerminalWindows.Add(window); window.component.OnSetup(); } terminal.OnSetup(); } } //AllSetup AllSetup = true; foreach (TerminalWindow window in TerminalWindows) { if (window.menu.block.Location.Grid == grid) { window.OnAllSetup(); } } }
/// <summary>Hides all terminals.</summary> public void HideAllTerminals() { for (int i = 0; i < TerminalWindows.Count; i++) { Destroy(TerminalWindows[i].gameObject); } TerminalWindows.Clear(); }