public void OnButton(CS_Prop_Button.ButtonType g_type) { switch (g_type) { case CS_Prop_Button.ButtonType.Quit: OnButtonQuit(); break; case CS_Prop_Button.ButtonType.Continue: OnButtonContinue(); break; } }
private void ShowButton(CS_Prop_Button.ButtonType g_type) { foreach (CS_Prop_Button f_button in myButtons) { if (f_button.MyButtonType == g_type && f_button.gameObject.activeSelf == false) { f_button.gameObject.SetActive(true); f_button.transform.position = GetRandomSpawnArea().GetRandomPoint(); return; } } //create a new one CreateButton(g_type, true); }
private void CreateButton(CS_Prop_Button.ButtonType g_type, bool g_startActive) { //create a new one GameObject t_buttonObject; if (g_type == CS_Prop_Button.ButtonType.Continue) { t_buttonObject = Instantiate(myButtonContinuePrefab, this.transform) as GameObject; } else { t_buttonObject = Instantiate(myButtonQuitPrefab, this.transform) as GameObject; } if (t_buttonObject == null) { Debug.LogError("cannot create this type of button: " + g_type.ToString()); return; } myButtons.Add(t_buttonObject.GetComponent <CS_Prop_Button> ()); t_buttonObject.transform.position = GetRandomSpawnArea().GetRandomPoint(); t_buttonObject.SetActive(g_startActive); }