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(); }
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(); }
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(); }
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(); }
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 } } ); } }
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); }
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); }
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 } } ); }