예제 #1
0
        private async Task RunGameplayLoopAsync()
        {
            turnCount = 0;

            while (true)
            {
                reactionStarted = false;

                await ShowInteractiveTutorialsOrEnableToolsAsync();

                await Awaiters.Until(() => reactionStarted || gameEnded);

                if (gameEnded)
                {
                    break;
                }

                boardManipulator.LockPredictions();

                await levelCounter.IncrementTurns().Completion();

                if (gameEnded)
                {
                    break;
                }

                int previousLevel = simulator.DifficultyLevel;

                await PlayBackReactionAsync();

                if (gameEnded)
                {
                    break;
                }

                if (simulator.DifficultyLevel > previousLevel)
                {
                    await levelCounter.IncrementLevel().Completion();

                    if (gameEnded)
                    {
                        break;
                    }
                }

                await StartNewTurn();

                if (gameEnded)
                {
                    break;
                }

                if (!simulator.FurtherMatchesPossible() && !boardManipulator.AnyToolsAvailable())
                {
                    EndGame();
                    break;
                }
            }
        }
예제 #2
0
        public async Task <Scene> Load(string name, LoadSceneMode mode = LoadSceneMode.Additive, bool activate = true)
        {
            sceneNames.Add(name);

            var operation = SceneManager.LoadSceneAsync(name, mode);
            await Awaiters.Until(() => operation.isDone);

            var scene = SceneManager.GetSceneByName(name);

            if (activate)
            {
                SceneManager.SetActiveScene(scene);
            }

            return(scene);
        }