private void Awake() { Instance = this; winSourse = gameObject.AddComponent <AudioSource>(); winSourse.clip = winClip; winSourse.playOnAwake = false; gameObject.SetActive(false); }
void showWinPopUp() { GameObject parent = UICamera.first.transform.parent.gameObject; Debug.Log("PARENT NAME: " + parent.name); //Prefab GameObject obj = NGUITools.AddChild(parent, winPopUpPrefab); WinPopUp popup = obj.GetComponent <WinPopUp>(); }
void winWindow(HeroRabbit rabbit) { GameObject parent = UICamera.first.transform.parent.gameObject; //Створити Prefab GameObject obj = NGUITools.AddChild(parent, winPrefab); //Отримати доступ до компоненту (щоб передати параметри) WinPopUp popup = obj.GetComponent <WinPopUp>(); //??? rabbit.winTune(); //... }
void showSettings() { //Знайти батьківський елемент GameObject parent = UICamera.first.transform.parent.gameObject; //Створити Prefab GameObject obj = NGUITools.AddChild(parent, winPrefab); //Отримати доступ до компоненту (щоб передати параметри) WinPopUp popup = obj.GetComponent <WinPopUp>(); //... //popup.setFruitsCounts(3, 13);// }
protected override void OnRabitHit(HeroRabit rabit) { GameObject parent = UICamera.first.transform.parent.gameObject; GameObject obj = NGUITools.AddChild(parent, winPopUpPrefab); WinPopUp winPopUp = obj.GetComponent <WinPopUp>(); LevelStatistic stats = LevelController.current.getStats(); foreach (int f in stats.collectedFruits) { Debug.Log(f); } winPopUp.setStats(stats); Destroy(HeroRabit.lastRabit); stats.save(); }
private void Awake() { current = this; gameObject.SetActive(false); }