Exemple #1
0
        public override void OnEnter(StatedMono <LevelStateEnum> statedMono)
        {
            LevelSystem levelSystem = statedMono as LevelSystem;

            int currentScore = ServiceProvider.GetService <ScoreSystem>().GetScore();
            PersistentDataSystem persistentDataSystem = ServiceProvider.GetService <PersistentDataSystem>();
            ScoreSavedData       scoreSavedData       = persistentDataSystem.GetSavedData <ScoreSavedData>();
            int bestScore = scoreSavedData.bestScore;

            if (bestScore < currentScore)
            {
                scoreSavedData.bestScore = currentScore;
                persistentDataSystem.SaveData(scoreSavedData);
            }

            ServiceProvider.GetService <ResultScreenView>().Show(currentScore, scoreSavedData.bestScore);

            IPausable[] pausables = GameObjectExtensions.FindObjectsOfTypeAll <IPausable>(true);

            for (int i = 0; i < pausables.Length; i++)
            {
                pausables[i].Pause(); //Awake all entities in the level
            }

            timer = levelSystem.clock.CurrentRenderTime + 5f;
        }
Exemple #2
0
        public override void OnUpdate(StatedMono <LevelStateEnum> statedMono)
        {
            if (waitCoroutine == null && timer == -1)
            {
                ServiceProvider.GetService <AutoScriptFlowSystem>().autoIAwake = true;

                IAwakable[] awakables = GameObjectExtensions.FindObjectsOfTypeAll <IAwakable>(true);

                for (int i = 0; i < awakables.Length; i++)
                {
                    awakables[i].IAwake(); //Awake all entities in the level
                }

                timer = ((LevelSystem)statedMono).clock.CurrentRenderTime + 1.5f;
            }
        }
Exemple #3
0
        public override void OnEnter(StatedMono <LevelStateEnum> statedMono)
        {
            ServiceProvider.GetService <AutoScriptFlowSystem>().autoIStart = true;

            IStartable[] startables = GameObjectExtensions.FindObjectsOfTypeAll <IStartable>(true);

            for (int i = 0; i < startables.Length; i++)
            {
                startables[i].IStart(); //Awake all entities in the level
            }

            Grid grid = ServiceProvider.GetService <Grid>();

            grid.StartBehaviour(GridStateEnum.GENERATING_PIECES);
            grid.Generate(((LevelSystem)statedMono).gridSize);
            timer = ServiceProvider.GetService <Timer>();
            timer.maxAllowedTime = 60f;
        }