void Start() { gameObject.GetComponent <Image>().enabled = false; RectTransform thing = GameObject.Find("Controles").GetComponent <RectTransform>(); menuPanels[0] = new MenuSheet(thing, thing.anchoredPosition.normalized); thing = GameObject.Find("Pause Menu").GetComponent <RectTransform>(); menuPanels[1] = new MenuSheet(thing, thing.anchoredPosition.normalized); thing = GameObject.Find("Reference").GetComponent <RectTransform>(); menuPanels[2] = new MenuSheet(thing, thing.anchoredPosition.normalized); buttons[command].sprite = originals[command]; buttons[command].sprite = tradables[command]; }
IEnumerator MoveMenu(MenuSheet panel, bool reverse) { int multiplier = reverse? -1: 1; while (-panel.sheet.anchoredPosition != menu.anchoredPosition) { menu.transform.Translate((menu.anchoredPosition - panel.sheet.anchoredPosition).normalized * 2000 * Time.fixedUnscaledDeltaTime * multiplier); if (multiplier * (Mathf.Abs(panel.sheet.anchoredPosition.x) - Mathf.Abs(menu.anchoredPosition.x)) < 100 && multiplier * (Mathf.Abs(panel.sheet.anchoredPosition.y) - Mathf.Abs(menu.anchoredPosition.y)) < 100) { menu.anchoredPosition = -panel.sheet.anchoredPosition; } yield return(null); } }
void Start() { RectTransform thing = GameObject.Find("PlayOnlineBackground").GetComponent <RectTransform>(); menuPanels[0] = new MenuSheet(thing, thing.anchoredPosition.normalized); thing = GameObject.Find("MonkeySelectionMenu").GetComponent <RectTransform>(); menuPanels[1] = new MenuSheet(thing, thing.anchoredPosition.normalized); thing = GameObject.Find("OptionsBackground").GetComponent <RectTransform>(); menuPanels[2] = new MenuSheet(thing, thing.anchoredPosition.normalized); thing = GameObject.Find("Credits").GetComponent <RectTransform>(); menuPanels[3] = new MenuSheet(thing, thing.anchoredPosition.normalized); thing = GameObject.Find("StartMenuContents").GetComponent <RectTransform>(); menuPanels[4] = new MenuSheet(thing, thing.anchoredPosition.normalized); activePanel = menuPanels[4]; //buttons[command].sprite = originals[command]; //buttons[command].sprite = tradables[command]; }
IEnumerator MoveMenu(MenuSheet panel, bool reverse) { Vector2 target = new Vector2(0, 0); int multiplier = reverse? -1: 1; while (panel.sheet.anchoredPosition != -menu.anchoredPosition) { menu.transform.Translate((menu.anchoredPosition - panel.sheet.anchoredPosition).normalized * 1000 * Time.unscaledDeltaTime * multiplier); //panel.group.alpha = (panel.sheet.position.x - panel.sheet.anchoredPosition.x) / (activePanel.sheet.anchoredPosition.x - panel.sheet.anchoredPosition.x); //activePanel.group.alpha = (activePanel.sheet.position.x - activePanel.sheet.anchoredPosition.x)/(-panel.sheet.localPosition.x - activePanel.sheet.localPosition.x); if (multiplier * (Mathf.Abs(panel.sheet.anchoredPosition.x) - Mathf.Abs(menu.anchoredPosition.x)) < 100 && multiplier * (Mathf.Abs(panel.sheet.anchoredPosition.y) - Mathf.Abs(menu.anchoredPosition.y)) < 100) { menu.anchoredPosition = -panel.sheet.anchoredPosition; } yield return(null); } panel.group.alpha = 1; panel.group.interactable = true; panel.group.blocksRaycasts = true; activePanel.group.alpha = 0; activePanel.group.interactable = false; activePanel.group.blocksRaycasts = false; activePanel = panel; }