public void ShowMenu(bool show) { if (show && !UpgradeMenuShowing && CanUpgrade) { upgrades = new Dictionary <Upgrade.UpgradeType, Upgrade>(5); upgrades.Add(Upgrade.UpgradeType.Strength, Upgrade.CreateUpgrade(Upgrade.UpgradeType.Strength, this)); foreach (NodeTree <Upgrade.UpgradeType> t in upgradeTreePos.Children) { upgrades.Add(t.Data, Upgrade.CreateUpgrade(t.Data, this)); } menuShowing = true; if (UpgradeReady != null) { UpgradeReady(this, null); } } else if (!show && UpgradeMenuShowing) { Queue <ITouchable> iterator = new Queue <ITouchable>(App.Instance.Controller.Touchables); ITouchable u; while (iterator.Count > 0) { u = iterator.Dequeue(); if (u is Upgrade && ((Upgrade)u).UpgradeTarget == this) { App.Instance.Controller.Touchables.Remove(u); } } menuShowing = false; if (UpgradeDone != null) { UpgradeDone(this, null); } } }