/// <summary> /// Fire after calling <see cref="FailedGamePlay()"/> /// Will proccess continue logic during this phase. /// Note. during GameFaildFlow the GamePlay is still running but keeps in pause status. /// This flow may fire mutilple times during one gameplay. /// </summary> /// <returns></returns> IEnumerator GameFaildFlow() { EnterPause(); currentGamePlayData.OnGameFaild(); //已經接關過 if (!currentGamePlayData.IsContinueAvailable) { EndTheGame(); } //尚未接關過 else { isContinueing = true; BlockMonad <bool> continueFlowCoroutine = new BlockMonad <bool>(r => currentGamePlayData.OnContinueFlow(r)); yield return(continueFlowCoroutine.Do()); // Continue success if (continueFlowCoroutine.Result) { currentGamePlayData.OnContinue(); isFailed = false; isContinueing = false; // alreadyContinue = true; } else { isContinueing = false; EndTheGame(); } continueFlowCoroutine = null; } ResumePause(); }
/// <summary> /// Fire after calling <see cref="FailedGamePlay()"/> /// Will proccess continue logic during this phase. /// Note. during GameFaildFlow the GamePlay is still running but keeps in pause status. /// This flow may fire mutilple times during one gameplay. /// </summary> /// <returns></returns> async Task GameFaildFlow() { EnterPause(); await currentGamePlayData.OnGameFaild(); //已經接關過 if (!currentGamePlayData.IsContinueAvailable) { EndTheGame(); } //尚未接關過 else { isContinueing = true; var result = await currentGamePlayData.OnContinueFlow(); // Continue success if (result) { currentGamePlayData.OnContinue(); isFailed = false; isContinueing = false; // alreadyContinue = true; } else { isContinueing = false; EndTheGame(); } } ResumePause(); }