// 게임 오버 시에 이번 점수를 설정한다. public void setLastScore(ScoreControl.Score last_score) { this.last_socre = last_score; // 최고 점수 - 갱신 체크. this.high_score.score = Mathf.Max(this.high_score.score, this.last_socre.score); this.high_score.coins = Mathf.Max(this.high_score.coins, this.last_socre.coins); }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.score_disp = GameObject.FindGameObjectWithTag("Score Disp").GetComponent <ScoreDisp>(); this.high_score = GlobalParam.getInstance().getHighScore(); this.last_socre = GlobalParam.getInstance().getLastScore(); this.next_step = STEP.RESULT; this.sound_control = GameObject.Find("SoundRoot").GetComponent <SoundControl>(); }
// ゲームオーバー時に、今回のスコアーをセットする. public void setLastScore(ScoreControl.Score last_score) { this.last_socre = last_score; // ハイスコア―更新チェック. this.high_score.score = Mathf.Max(this.high_score.score, this.last_socre.score); this.high_score.coins = Mathf.Max(this.high_score.coins, this.last_socre.coins); }
void Update() { // ---------------------------------------------------------------- // // 스텝 내의 경과 시간을 진행한다. this.step_timer += Time.deltaTime; // ---------------------------------------------------------------- // // 다음 상태로 이행할지 체크한다. if (this.next_step == STEP.NONE) { switch (this.step) { case STEP.PLAY: { if (this.player.isPlayEnd()) { this.next_step = STEP.WAIT_CLICK; } } break; case STEP.WAIT_CLICK: { if (Input.GetMouseButtonDown(0)) { this.next_step = STEP.RESULT; } } break; } } // ---------------------------------------------------------------- // // 상태를 전환했을 때의 초기화. while (this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch (this.step) { case STEP.PLAY: { this.sound_control.playBgm(Sound.BGM.PLAY); } break; case STEP.WAIT_CLICK: { this.sound_control.stopBgm(); } break; case STEP.RESULT: { // 이번 스코어를 기록해 둔다. ScoreControl.Score score = this.score_control.getCurrentScore(); GlobalParam.getInstance().setLastScore(score); Application.LoadLevel("ResultScene"); } break; } this.step_timer = 0.0f; } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step) { case STEP.PLAY: { } break; } }