예제 #1
0
        public void Init(TimeAttackStage timeAttackStage)
        {
            this.timeAttackStage = timeAttackStage;

            this.lastTicks = this.timeAttackStage.GetRemainTicks();
            UpdateTimeText();
        }
예제 #2
0
        public void Init(bool isClear)
        {
            //이전에 사용된 element삭제
            for (int i = 0; i < this.elements.Count; i++)
            {
                ObjectPoolManager.inst.Return(this.elements[i].gameObject);
            }

            this.elements.Clear();

            this.titleText.text = isClear ? "클리어" : "실패";


            TimeSpan timeSpan   = new TimeSpan(StageMaster.current.scoreInfo.playTicks);
            int      totalScore = 0;

            CreateElement("플레이 타임", string.Format("{0:D2}:{1:D2}", timeSpan.Minutes, timeSpan.Seconds));
            if (isClear && StageMaster.current is TimeAttackStage) // 타임어택
            {
                TimeAttackStage stage = StageMaster.current as TimeAttackStage;

                // 시간 보너스
                int timeBonus = Mathf.CeilToInt((stage.timeLimit - (float)((stage.scoreInfo.endTicks - stage.scoreInfo.startTicks) / TimeSpan.TicksPerSecond)) * 1000);
                CreateElement("시간 보너스", KUtils.GetThousandCommaText(timeBonus));
                totalScore += timeBonus;
            }
            else if (isClear && StageMaster.current is MonsterCleaningStage) // 몬스터 소탕
            {
                MonsterCleaningStage stage = StageMaster.current as MonsterCleaningStage;

                // 처치보너스
                int killMonsterBonus = stage.scoreInfo.killMonster * 1500;
                if (killMonsterBonus > 0)
                {
                    CreateElement("처치 - 일반", KUtils.GetThousandCommaText(killMonsterBonus));
                    totalScore += killMonsterBonus;
                }

                int killBossBonus = stage.scoreInfo.killBoss * 30000;
                if (killBossBonus > 0)
                {
                    CreateElement("처치 - 일반", KUtils.GetThousandCommaText(killBossBonus));
                    totalScore += killBossBonus;
                }
            }

            this.totalScore.text = KUtils.GetThousandCommaText(totalScore);

            // 사운드 재생
            SoundManager.inst.StopBGM();
            if (isClear)
            {
                SoundManager.inst.PlaySound(SoundKeys.EFFECT_VICTORY, PlayerCamera.current.transform, Vector3.zero);
            }
            else
            {
                SoundManager.inst.PlaySound(SoundKeys.EFFECT_GAMEOVER, PlayerCamera.current.transform, Vector3.zero);
            }
        }
예제 #3
0
        /// <summary>
        /// 제한시간을 표시해주는 HUD를 추가한다.
        /// </summary>
        /// <param name="stage"></param>
        public void LoadTimeAttackHud(TimeAttackStage stage)
        {
            TimeAttackHud hud = ObjectPoolManager.inst.New <TimeAttackHud>(PrefabPath.UI.TimeAttackHud);

            hud.transform.SetParent(this._rootLayout, false);
            (hud.transform as RectTransform).anchoredPosition3D = Vector3.zero;
            hud.transform.localRotation = Quaternion.identity;
            hud.transform.localScale    = Vector3.one;

            hud.Init(stage);
        }
예제 #4
0
 private void OnDisable()
 {
     this.timeAttackStage = null;
 }