/// <summary> /// UI manager 초기화 함수. /// </summary> /// <returns></returns> private bool Initialize() { mPlayerInfo = GameManager.Instance.GetPlayerInfo(); if (mPlayerInfo == null) { Debug.Log("Failed Get PlayerInfo"); return(false); } mPlayerInfo = GameManager.Instance.GetPlayerInfo(); mPlayerInfo.AddObserver(mCoinLabel); mWaveManager = GameManager.Instance.GetWaveManager(); if (!mWaveManager) { Debug.Log("Failed Get Wave Manager"); return(false); } mSoundManager = GameManager.Instance.GetSoundManager(); if (!mSoundManager) { Debug.Log("Failed Get SoundManager"); return(false); } mMusicVolumeSlider.value = mSoundManager.MusicAudioSource.volume; mSfxVolumeSlider.value = mSoundManager.SfxAudioSource.volume; mPlayerInfo.AddObserver(mWaveLabel); mPlayerInfo.AddObserver(mLifeSet); mTouchGuard.gameObject.SetActive(false); Tower towerData = GameManager.Instance.GetObjectPool().GetTowerData(); mStoreGrid.repositionNow = true; mStoreGrid.gameObject.SetActive(false); GameObject setTower = Resources.Load("01.Prefabs/UI/Set Tower") as GameObject; if (setTower == null) { return(false); } for (int i = 0; i < towerData.dataArray.Length; i++) { GameObject uiSetTower = Instantiate(setTower, mStoreGrid.transform); string modelName = towerData.dataArray[i].Modelname; GameObject towerModel = Resources.Load("01.Prefabs/Tower/" + modelName) as GameObject; if (towerModel == null) { return(false); } GameObject tower = Instantiate(towerModel, uiSetTower.transform); tower.transform.GetChild(0).localScale = tower.transform.GetChild(0).localScale * 250.0f; tower.transform.localPosition = new Vector3(tower.transform.localPosition.x, mUITowerModelYPos, tower.transform.localPosition.z); UITowerRotation towerRotation = tower.AddComponent <UITowerRotation>(); uiTowerRotations.Add(towerRotation); Canon canon = tower.GetComponentInChildren <Canon>(); if (canon != null) { Destroy(canon); } UIButton btn = uiSetTower.GetComponentInChildren <UIButton>(); EventDelegate eventBtn = new EventDelegate(this, "OpenTowerBuyPanel"); eventBtn.parameters[0].value = towerData.dataArray[i]; eventBtn.parameters[1].value = uiTowerRotations[i].gameObject; btn.onClick.Add(eventBtn); btn.onClick.Add(new EventDelegate(ButtonClickSoundPlay)); GameManager.ChangeLayerMaskRecursively(tower.transform, "3D UI"); } mStoreGrid.Reposition(); for (int i = 0; i < 3; i++) { uiTowerRotations[i].RotateTower(); } mAdBtnCollider = mAdvertisementButton.GetComponent <BoxCollider2D>(); mReturnCollider = mReturnToBasicButton.GetComponent <BoxCollider2D>(); mReturnCollider.enabled = false; mDisapperRotation = new Vector3(0.0f, 90.0f, 0.0f); mReturnToBasicButton.transform.DOLocalRotate(mDisapperRotation, 0.0f); mTouchGuardOriginColor = mTouchGuard.GetComponentInChildren <UISprite>().color; return(true); }