Ejemplo n.º 1
0
    public Action OnMonsterRemovedFromList;      //몬스터 제거시 호출
    #endregion

    void Start()
    {
        SoundBgManager.instance.StopAnimAudio();
        SoundInGameBgManager.instance.PlayAnimAudio();

        if (DataManager.GetInstance().userInfo.isBgmOn == true)
        {
            SoundInGameBgManager.instance.MuteAudio(false);
        }
        else
        {
            SoundInGameBgManager.instance.MuteAudio(true);
        }

        if (DataManager.GetInstance().userInfo.isFXsoundOn == true)
        {
            SoundEffectManager.instance.MuteAudio(false);
        }
        else
        {
            SoundEffectManager.instance.MuteAudio(true);
        }

        easyObjectPool.Init(); silver = 30;

        OnDisplaySilver = () =>
        {
            lbSilver.text = silver.ToString();
        };

        OnDisplaySilver();

        SetTimeScale(1f);

        if (uI_FenceHp != null)
        {
            uI_FenceHp.Init();
        }
        else
        {
            var prefab = (GameObject)(from obj in App.instance.resource
                                      where obj.name == "UI_FenceHp"
                                      select obj).FirstOrDefault();
            this.uI_FenceHp = Instantiate(prefab).GetComponent <UI_FenceHp>();

            this.uI_FenceHp.transform.SetParent(this.uiRoot.transform);
            this.uI_FenceHp.transform.localScale    = Vector3.one;
            this.uI_FenceHp.transform.localPosition = Vector3.zero;

            uI_FenceHp.Init();
        }



        listHeroes    = new List <TestHero>();
        listFootholds = new List <GameObject>();

        GetStageNumber(App.instance.stageNumber); //App에서 몇스테이지 인지 받아옴

        DisplayTotalMonsterCount();               //총 몬스터 수 표시

        OnMonsterRemovedFromList = () =>
        {
            this.monsterCount -= 1;
            silver            += 5;
            OnDisplaySilver();
            DataManager.GetInstance().AddMonsterKiilCount(); //userInfo에 kiilCount 추가
            DisplayCurrentMonsterCount();                    //현재 몬스터 숫자 표시
            if (App.instance.gpgsLogin.firbaseUser != null)  //firebase의 이벤트에 killCount추가
            {
                Firebase.Analytics.Parameter[] param =
                {
                    new Firebase.Analytics.Parameter("killcount", DataManager.GetInstance().userInfo.monsterKillCount)
                };

                Firebase.Analytics.FirebaseAnalytics.LogEvent("killmonster", param);
            }
        };

        this.btnStart.onClick.Add(new EventDelegate(() =>
        {
            SoundEffectManager.effectSoundAction();
            timeCount = 0;
        }));
        btnNormalSpeed.onClick.Add(new EventDelegate(() =>
        {
            SoundEffectManager.effectSoundAction();
            SetTimeScale(1f);
        }));
        btnfast.onClick.Add(new EventDelegate(() =>
        {
            SoundEffectManager.effectSoundAction();
            //3배속으로 빠르게 플레이
            SetTimeScale(3f);
        }));

        AddEventsInGameButtons(); //게임 화면내 버튼에 이벤트 추가

        uIPopup_Victory.OnBtnLobbyClicked = () =>
        {
            SceneManager.LoadScene("Lobby2");
        };
        uIPopup_Fail.OnBtnLobbyClicked = () =>
        {
            SceneManager.LoadScene("Lobby2");
        };

        if (isStarted != true)
        {
            StartGame(stageId);
            SummonMonsters();
            isStarted = true;
        }
    }
Ejemplo n.º 2
0
 protected override void OnMainControllerAwaken()
 {
     Init();
     pool.Init();
 }