コード例 #1
0
        // /// <summary>
        // /// Is GamePlay alreadyContinue, value will keep until next gameplay start.
        // /// </summary>
        // /// <value></value>
        // public bool alreadyContinue { get; private set; } = false;

        IEnumerator GamePlayTask()
        {
            Rayark.Mast.Coroutine gamePlayCoroutine = new Rayark.Mast.Coroutine(currentGamePlayData.GamePlay());

            while (isQuiting == false && isGaming == true)
            {
                if (!gamePlayCoroutine.Finished)
                {
                    gamePlayCoroutine.Resume(Rayark.Mast.Coroutine.Delta);
                }
                else
                {
                    Debug.LogError("gamePlayCoroutine is finished, Remember to call   gamePlayController.SuccessGamePlay(); in the end of GamePlay IEnumrator");
                    Debug.Break();
                }
                yield return(null);
            }

            currentGamePlayData.OnLeaveGame();
            //Normal Game Ending, can be player died or clear
            if (isQuiting == false)
            {
                if (isFailed == true)
                {
                    //Game Faild
                    currentGamePlayData.OnGameLose();
                }
                else
                {
                    //Game Success
                    currentGamePlayData.OnGameSuccess();
                }

                gameResultCoroutine = new Rayark.Mast.Coroutine(currentGamePlayData.GameResult());
                while (!gameResultCoroutine.Finished)
                {
                    gameResultCoroutine.Resume(Rayark.Mast.Coroutine.Delta);
                    yield return(null);
                }
                gameResultCoroutine = null;
            }
            //Game Ending by external reason, e.g. Quit from UI
            else
            {
                isQuiting = false;
            }

            currentGamePlayData.OnGameEnd();
            EndTheGame();
        }
コード例 #2
0
 /// <summary>
 /// Failed and exit the gameplay, this will fire continue flow(if continue is available)
 /// <see cref="GameFaildFlow()"/> for the contniue behaviour
 /// or <see cref="ScriptableObjectGamePlayData.OnContinueFlow(IReturn{bool})()"/> for your continue implement
 /// </summary>
 public void FailedGamePlay()
 {
     isFailed = true;
     Rayark.Mast.Coroutine coroutine = new Rayark.Mast.Coroutine(GameFaildFlow());
     AddToUnpauseUpdateExecuter(coroutine);
 }