Ejemplo n.º 1
0
    IEnumerator CoGameStart()
    {
        if (isShowAd)
        {
            AdManager.ShowBannerAd(BannerAdPosition.Bottom, BannerAdSize.SmartBanner);
        }
        yield return(null);

        //레벨 번호 보이고 사라짐
        int levelNum = 0;

        Int32.TryParse(MadLevel.arguments, out levelNum);
        Debug.Log("arg " + MadLevel.arguments);
        Debug.Log("levelNum " + levelNum);
        uiManager.textLevelNum.GetComponent <Text>().text = " - " + levelNum + " - ";

        uiManager.textLevelNum.SetActive(true);
        //////////

        //ObstacleCtrl 들 시작
        if (EventGameStart != null)
        {
            EventGameStart();
        }
        //////////////

        goalCtrl.trigger.radius = 0.4f;

        yield return(new WaitForSeconds(0.8f));

        yield return(StartCoroutine(goalCtrl.CoGameStart()));

        yield return(StartCoroutine(playerCtrl.CoGameStart()));

        if (isShowAd)
        {
            AdManager.HideBannerAd(BannerAdNetwork.AdMob);
        }

        uiManager.textLevelNum.SetActive(false);

        //UI 클리어시 이벤트 추가
        uiManager.goBtnGameNext.GetComponent <Button>().onClick.AddListener(() =>
        {
            MadLevel.LoadNext();
        });
        uiManager.goBtnGameBack.GetComponent <Button>().onClick.AddListener(() =>
        {
            MadLevel.LoadLevelByName("LevelSelectScreen");
        });
        uiManager.goBtnGameRestart.GetComponent <Button>().onClick.AddListener(() =>
        {
            MadLevel.ReloadCurrent();
        });
        //////////////////

        gameState = eGameState.gamePlaying;

        if (isShowAd)
        {
            EasyMobileManager.ShowInterstitialAd();
        }
    }