public void JumpButton_Click() { if (isJumped) { return; } tutorialTextBoard.SetActive(false); isJumped = true; jumpSubject.OnNext(0); float time = 0; var disposable = new SingleAssignmentDisposable(); disposable.Disposable = this.UpdateAsObservable(). Subscribe(_ => { if (isGameOver) { disposable.Dispose(); } else if (isCleared) { if (Input.GetKeyDown(KeyCode.Space)) { nowStageNum++; time = 0; if (Stages.stageData.Length > nowStageNum) { clearImage.SetActive(false); Reflesher.Reflesh(); buildingsScroller.Scroll(); disposable.Dispose(); } else { SceneManager.LoadScene("GameClearScene"); } } } else if (time > clearSecnods) { StageClear(); } else { time += Time.deltaTime; clearCountText.text = "クリアまで " + (clearSecnods - (int)time).ToString() + "秒"; } }); }
public void GameOver() { if (isCleared) { return; } isGameOver = true; gameOverImage.SetActive(true); clearCountText.text = ""; var disposable = new SingleAssignmentDisposable(); disposable.Disposable = this.UpdateAsObservable().Where(_ => isJumped).Subscribe(_ => { if (Input.anyKey) { gameOverImage.SetActive(false); Reflesher.Reflesh(); StartStage(); isGameOver = false; disposable.Dispose(); } }); }