Ejemplo n.º 1
0
        private void OnRestartClicked()
        {
            Contexts.sharedInstance.saveData.DestroyAllEntities();

            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToRestartTransition,
                TransitionComponent = new ControllerToRestartTransitionComponent {
                    Value = GameControllerType.Speedrun
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToRestartTransition,
                TransitionComponent = new ControllerToRestartTransitionComponent {
                    Value = GameControllerType.Game
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.LevelIndexToLoadTransition,
                TransitionComponent = new LevelIndexToLoadTransitionComponent
                {
                    Value = 1
                }
            }
                );

            ((GameEntity)gameObject.GetEntityLink().entity).DestroyEntity();
        }
Ejemplo n.º 2
0
        private void OnNextLevelClicked()
        {
            IGroup <GameEntity> levelEntityGroup = Contexts.sharedInstance.game.GetGroup(GameMatcher.Level);
            int levelCount        = GameConfigurations.AssetReferenceConfiguration.LevelAssetReferences.Length;
            int currentLevelIndex = levelEntityGroup.GetSingleEntity().levelIndex.Value;

            Contexts.sharedInstance.saveData.isSaveGameTrigger = true;
            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToRestartTransition,
                TransitionComponent = new ControllerToRestartTransitionComponent {
                    Value = GameControllerType.Game
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.LevelIndexToLoadTransition,
                TransitionComponent = new LevelIndexToLoadTransitionComponent
                {
                    Value = currentLevelIndex < levelCount - 1 ? currentLevelIndex + 1 : 1
                }
            }
                );
            ((GameEntity)gameObject.GetEntityLink().entity).DestroyEntity();
        }
Ejemplo n.º 3
0
        private void OnRestartClicked()
        {
            IGroup <GameEntity> levelEntityGroup = Contexts.sharedInstance.game.GetGroup(GameMatcher.Level);

            Contexts.sharedInstance.saveData.isSaveGameTrigger = true;
            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToRestartTransition,
                TransitionComponent = new ControllerToRestartTransitionComponent {
                    Value = GameControllerType.Game
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.LevelIndexToLoadTransition,
                TransitionComponent = new LevelIndexToLoadTransitionComponent
                {
                    Value = levelEntityGroup.GetSingleEntity().levelIndex.Value
                }
            }
                );

            ((GameEntity)gameObject.GetEntityLink().entity).DestroyEntity();
        }
Ejemplo n.º 4
0
        private void OnStartGameClicked()
        {
            Contexts.sharedInstance.gameSettings.isSpeedrun = false;

            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToTeardownTransition,
                TransitionComponent = new ControllerToTeardownTransitionComponent
                {
                    Value = GameControllerType.MainMenu
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToRemove,
                TransitionComponent = new SceneToRemoveComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.MainMenuSceneName
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToAdd,
                TransitionComponent = new SceneToAddComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.LevelSelectionSceneName
                }
            }
                );

            GameEntity mainMenuEntity = gameObject.GetEntityLink().entity as GameEntity;

            mainMenuEntity?.DestroyEntity();
        }
Ejemplo n.º 5
0
        protected override async void Execute(List <GameEntity> entities)
        {
            int levelCount        = GameConfigurations.AssetReferenceConfiguration.LevelAssetReferences.Length;
            int currentLevelIndex = _levelEntityGroup.GetSingleEntity().levelIndex.Value;

            if (Contexts.sharedInstance.game.isAllCollectedInLevel)
            {
                if (currentLevelIndex >= levelCount - 1)
                {
                    GameContext gameContext = Contexts.sharedInstance.game;
                    GameEntity  finishSpeedrunDialogEntity = gameContext.CreateEntity();
                    await AssetLoaderUtils.InstantiateAssetAsyncTask(GameConfigurations.AssetReferenceConfiguration.FinishSpeedrunDialogReference, finishSpeedrunDialogEntity, gameContext.staticLayer.Value.transform);

                    finishSpeedrunDialogEntity.isFinishSpeedrunDialog = true;
                }
                else
                {
                    TransitionUtils.StartTransitionSequence(
                        new TransitionComponentData
                    {
                        Index = GameComponentsLookup.ControllerToRestartTransition,
                        TransitionComponent = new ControllerToRestartTransitionComponent {
                            Value = GameControllerType.Game
                        }
                    },
                        new TransitionComponentData
                    {
                        Index = GameComponentsLookup.LevelIndexToLoadTransition,
                        TransitionComponent = new LevelIndexToLoadTransitionComponent
                        {
                            Value = currentLevelIndex < levelCount - 1 ? currentLevelIndex + 1 : 1
                        }
                    }
                        );
                }
            }
            else
            {
                TransitionUtils.StartTransitionSequence(
                    new TransitionComponentData
                {
                    Index = GameComponentsLookup.ControllerToRestartTransition,
                    TransitionComponent = new ControllerToRestartTransitionComponent {
                        Value = GameControllerType.Game
                    }
                },
                    new TransitionComponentData
                {
                    Index = GameComponentsLookup.LevelIndexToLoadTransition,
                    TransitionComponent = new LevelIndexToLoadTransitionComponent
                    {
                        Value = currentLevelIndex
                    }
                }
                    );
            }
        }
Ejemplo n.º 6
0
        private void OnStartGameButtonClicked()
        {
            Contexts.sharedInstance.gameSettings.isSpeedrun = true;
            Contexts.sharedInstance.saveData.DestroyAllEntities();

            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToTeardownTransition,
                TransitionComponent = new ControllerToTeardownTransitionComponent
                {
                    Value = GameControllerType.MainMenu
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToRemove,
                TransitionComponent = new SceneToRemoveComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.MainMenuSceneName
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToAdd,
                TransitionComponent = new SceneToAddComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.GameSceneName,
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.LevelIndexToLoadTransition,
                TransitionComponent = new LevelIndexToLoadTransitionComponent {
                    Value = 1
                }
            }
                );

            GameEntity mainMenuEntity = gameObject.GetEntityLink().entity as GameEntity;

            gameObject.Unlink();
            mainMenuEntity?.Destroy();
            Destroy(gameObject);
        }
Ejemplo n.º 7
0
        private void OnMainMenuClicked()
        {
            Contexts.sharedInstance.saveData.isSaveGameTrigger = true;
            Contexts.sharedInstance.gameSettings.isSpeedrun    = false;
            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToTeardownTransition,
                TransitionComponent = new ControllerToTeardownTransitionComponent
                {
                    Value = GameControllerType.Game
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToRemove,
                TransitionComponent = new SceneToRemoveComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.GameSceneName
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToAdd,
                TransitionComponent = new SceneToAddComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.MainMenuSceneName
                }
            }
                );

            GameEntity dialogEntity = gameObject.GetEntityLink().entity as GameEntity;

            gameObject.Unlink();
            dialogEntity?.Destroy();
            Destroy(gameObject);
        }
Ejemplo n.º 8
0
 protected override void Execute(List <GameEntity> entities)
 {
     TransitionUtils.StartTransitionSequence(
         new TransitionComponentData
     {
         Index = GameComponentsLookup.ControllerToTeardownTransition,
         TransitionComponent = new ControllerToTeardownTransitionComponent
         {
             Value = GameControllerType.LevelSelection
         }
     },
         new TransitionComponentData
     {
         Index = GameComponentsLookup.SceneToRemove,
         TransitionComponent = new SceneToRemoveComponent
         {
             Value = GameConfigurations.GameSceneConfiguration.LevelSelectionSceneName
         }
     },
         new TransitionComponentData
     {
         Index = GameComponentsLookup.SceneToAdd,
         TransitionComponent = new SceneToAddComponent
         {
             Value = GameConfigurations.GameSceneConfiguration.GameSceneName,
         }
     },
         new TransitionComponentData
     {
         Index = GameComponentsLookup.LevelIndexToLoadTransition,
         TransitionComponent = new LevelIndexToLoadTransitionComponent {
             Value = entities[0].levelSelected.Value
         }
     }
         );
 }