void Start() { mTrackCreator = new Map.CTrackCreator(this.transform); mTrackCreator.CreateTrackData(); mTrackCreator.PositionTracks(); mTrackCreator.UpdateTrackTile(0); }
private void Awake() { InstPlayer.SetScene(this); InstItemTimer.SetScene(this); mPlayGameData = Resources.Load <CPlayGameData>("GameData/CPlayGameData"); mUserData = new UserData(); mItemdata = new CItemData(); mUIPlayGame = FindObjectOfType <CUIPlayGame>(); if (mItemdata.Item4 == 1) { IsStartBoost = true; InstStartBoost.gameObject.SetActive(true); } mAudioData = mUIPlayGame.GetComponent <CAudio>(); this.AudioData.StartBGSound(); CPlayerController tController = null; #if UNITY_EDITOR tController = GetComponentInChildren <CKeyboardPlayerController>(); #elif UNITY_ANDROID tController = GetComponentInChildren <CUIPlayerController>(); #endif //플레이어 컨트롤러 세팅 tController.SetCallOnJump(InstPlayer.DoJump); tController.SetCallOnJump(() => mIsInputJumpAndSlide = true); tController.SetCallOnSlide(InstPlayer.DoSlide); tController.SetCallOnSlide(() => mIsInputJumpAndSlide = true); tController.SetCallOnScreenSlide(InstPlayer.SetRotateInput); InstPlayer.SetFuncHorizontal(tController.GetHorizontal); //플레이어의 상태 변화 콜백 InstPlayer.SetCallOnRotate(InstTargetCamera.RotateCamera); InstPlayer.SetCallOnGameOver(OnGameOver); //게임오버 - 로비 이동 mUIPlayGame.InstBtnMoveLobby.onClick.AddListener(OnMoveLobby); //일시정지 UI On,Off mUIPlayGame.InstBtnPause.onClick.AddListener(() => OnPause(true)); mUIPlayGame.InstBtnPauseClose.onClick.AddListener(() => OnPause(false)); //포기 확인 mUIPlayGame.InstBtnSubmitRetire.onClick.AddListener(OnRetire); if (mItemdata.Item1 == 1) { mUIPlayGame.InstSliderAddHPBar.gameObject.SetActive(true); InstPlayer.AddHp.Subscribe((hp) => { mUIPlayGame.InstSliderAddHPBar.value = (float)hp / InstPlayer.AddHpValue; if (mUIPlayGame.InstSliderAddHPBar.value <= 0) { mUIPlayGame.InstSliderAddHPBar.gameObject.SetActive(false); } }); } InstPlayer.CurrentHp.Subscribe((hp) => mUIPlayGame.InstSliderHPBar.value = (float)hp / InstPlayer.Hp); InstPlayer.CurrentBoost.Subscribe((boost) => mUIPlayGame.InstSliderBoostBar.value = boost / InstPlayer.Boost); mScore = new FloatReactiveProperty(); mScore.Subscribe((score) => { TotalScore = (int)score + (mCoin.Value * (int)CoinPerScore); mUIPlayGame.SetTxtScore(TotalScore); mUIPlayGame.SetTxtPauseScore(TotalScore); }); mCoin = new IntReactiveProperty(); mCoin.Subscribe((coin) => mUIPlayGame.SetTxtCoin(coin)); mTrackCreator = new Map.CTrackCreator(this.transform); mTrackCreator.OnShowEndTrack = (left, right) => { mUIPlayGame.ShowTxtSelectTheme(left, right); }; mTrackCreator.OnSelectTheme = (select) => { mUIPlayGame.SelectTheme(select); }; mTrackCreator.OnChangeStage = (stage, theme) => { mCurrentStage = stage; if (IsStartBoost == true) { if (stage != 1) { mItemdata.Item4 = 0; IsStartBoost = false; InstItemTimer.Reset(); } } if (mCurrentStageTick != null) { StopCoroutine(mCurrentStageTick); } InstPlayer.ResetSideSpeed(); switch (theme) { case 0: mCurrentStageTick = StartCoroutine(StageTick_1()); break; case 1: mCurrentStageTick = StartCoroutine(StageTick_2()); break; case 2: InstPlayer.SideSpeed = 20.0f; mUIPlayGame.ShowSlideIcon(); break; } }; if (mItemdata.Item2 == 1) { mUIPlayGame.InstItem_1.gameObject.SetActive(false); } else { mUIPlayGame.InstItem_1.gameObject.SetActive(true); } if (mItemdata.Item3 == 1) { mUIPlayGame.InstItem_2.gameObject.SetActive(false); } else { mUIPlayGame.InstItem_2.gameObject.SetActive(true); } mTrackCreator.CreateTrackData(); mTrackCreator.PositionTracks(); mTrackCreator.UpdateTrackTile(0); }