Ejemplo n.º 1
0
    void    Update()
    {
        // -------------------------------------------------------------------- //
        // 스텝 내의 경과 시간을 진행한다.

        this.step_timer += Time.deltaTime;

        // -------------------------------------------------------------------- //
        // 다음 상태로 갈지 체크한다.


        if (this.next_step == STEP.NONE)
        {
            switch (this.step)
            {
            case STEP.RESULT:
            {
                if (Input.GetMouseButtonDown(0))
                {
                    this.next_step = STEP.RESULT_ACTION;
                    this.sound_control.playSound(Sound.SOUND.CLICK);
                }
            }
            break;

            case STEP.RESULT_ACTION:
            {
                if (this.step_timer > ACTION_TIME)
                {
                    this.next_step = STEP.TITLE;
                }
            }
            break;
            }
        }

        // -------------------------------------------------------------------- //
        // 상태가 전환됐을 때의 초기화.

        while (this.next_step != STEP.NONE)
        {
            this.step      = this.next_step;
            this.next_step = STEP.NONE;

            switch (this.step)
            {
            case STEP.RESULT:
            {
                // 최고 점수를 보존.
                GlobalParam.getInstance().saveSaveData();

                this.sound_control.playBgm(Sound.BGM.RESULT);
            }
            break;

            case STEP.RESULT_ACTION:
            {
                this.sound_control.stopBgm();
                this.disp_last_score = this.last_socre.score;
            }
            break;



            case STEP.TITLE:
            {
                Application.LoadLevel("TitleScene");
            }
            break;
            }

            this.step_timer = 0.0f;
        }

        // -------------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step)
        {
        case STEP.RESULT:
            this.disp_last_score += (int)(100 * Time.deltaTime);
            this.disp_last_score  = Mathf.Clamp(this.disp_last_score, 0, this.last_socre.score);
            if (this.disp_last_score < this.last_socre.score)
            {
                this.sound_control.playSound(Sound.SOUND.COIN_GET);
            }
            break;
        }
    }