protected void LoadSceneCommandHandler(LoadSceneCommand cmd) { //Do not load scene if scene is already loaded and cmd.doNotLoadIfSceneAlreadyExists is set to true (default) //if(cmd.doNotLoadIfSceneAlreadyExists && _sceneService.IsSceneLoaded(cmd.sceneID)) return; if (cmd.asynchron) { _sceneService.LoadAsync(cmd.sceneID, cmd.additive, cmd.makeActive); } else { _sceneService.Load(cmd.sceneID, cmd.additive, cmd.makeActive); } }
private IEnumerator Fade(float aFadeOutTime, float aFadeInTime, Color aColor, bool loadAdditive) { float t = 0.0f; while (t < 1.0f) { yield return(new WaitForEndOfFrame()); t = Mathf.Clamp01(t + Time.deltaTime / aFadeOutTime); DrawQuad(aColor, t); } LoadSceneCommand.DestroyUnusingContexts(); yield return(new WaitForEndOfFrame()); if (m_LevelName != "") { if (loadAdditive) { Application.LoadLevelAdditive(m_LevelName); } else { Application.LoadLevel(m_LevelName); } } else if (loadAdditive) { Application.LoadLevelAdditive(m_LevelIndex); } else { Application.LoadLevel(m_LevelIndex); } while (t > 0.0f) { yield return(new WaitForEndOfFrame()); t = Mathf.Clamp01(t - Time.deltaTime / aFadeInTime); DrawQuad(aColor, t); } m_Fading = false; }
public override void InstallBindings() { Container.Bind <IApplicationDataModule>().To <ApplicationDataModule>().AsSingle(); Container.Bind <IGameSettings>().To <GameSettings>().AsSingle(); Container.Bind <IUserData>().To <UserData>().AsSingle(); SignalBusInstaller.Install(Container); Container.DeclareSignal <LoadingCompleteSignal>(); Container.DeclareSignal <TryStartGameSignal>(); Container.DeclareSignal <TryExitFromGameSignal>(); Container.Bind <LoadSceneCommand>().AsTransient(); Container.BindSignal <LoadingCompleteSignal>().ToMethod <LoadSceneCommand>((x, s) => x.LoadScene(ScenesNames.MAIN_MENU_SCENE)).FromResolve(); Container.BindSignal <TryStartGameSignal>().ToMethod <LoadSceneCommand>((x, s) => x.LoadScene(ScenesNames.GAME_SCENE)).FromResolve(); Container.BindSignal <TryExitFromGameSignal>().ToMethod <LoadSceneCommand>((x, s) => x.LoadScene(ScenesNames.MAIN_MENU_SCENE)).FromResolve(); LoadSceneCommand loadSceneCommand = new LoadSceneCommand(); loadSceneCommand.LoadScene(ScenesNames.LOADING_SCENE); }
public override void Awake() { base.Awake(); Command animationManagerCommand = new LoadManagerCommand(this, new List <GameObject> { AnimationManager }); Command splashAnimation = new TransitionAnimationCommand(this, AnimationType.SplashScene, false); Command transitionAnimation = new TransitionAnimationCommand(this, AnimationType.Transition, true); Command managersCommand = new LoadManagerCommand(this, _managersInGame); Command loadSceneCommand = new LoadSceneCommand(this, ScenesType.MainScene); Command loadMainViewCommand = new LoadViewCommand(this, ViewType.HomeView); Command transitionAnimationClose = new TransitionAnimationCommand(this, AnimationType.Transition, false); _commands.Enqueue(animationManagerCommand); _commands.Enqueue(splashAnimation); _commands.Enqueue(transitionAnimation); _commands.Enqueue(managersCommand); _commands.Enqueue(loadSceneCommand); _commands.Enqueue(loadMainViewCommand); _commands.Enqueue(transitionAnimationClose); StartLoadGame(); }
public ViewModels(Models models) { m_models = models; // view model initialization ConsoleOutput = new ConsoleOutputViewModel(m_models); Display = new DisplayViewModel(m_models); Cameras = new CamerasViewModel(m_models); Lights = new LightsViewModel(m_models); Materials = new MaterialsViewModel(m_models); Toolbar = new ToolbarViewModel(m_models); Statusbar = new StatusbarViewModel(m_models); Profiler = new ProfilerViewModel(m_models); Renderer = new RendererViewModel(m_models, Toolbar.PlayPauseCommand, Toolbar.ResetCommand); Scene = new SceneViewModel(m_models); RenderTargetSelection = new RenderTargetSelectionViewModel(m_models, Toolbar.ResetCommand); LoadWorld = new LoadWorldViewModel(m_models); AnimationFrames = new AnimationFrameViewModel(m_models); Tessellation = new TessellationViewModel(m_models); // command initialization AddLightCommand = new AddLightCommand(m_models); LoadSceneCommand = new LoadSceneCommand(m_models); SaveSceneCommand = new SaveSceneCommand(m_models); SelectRendererCommand = new SelectRendererCommand(m_models); OpenSettingsCommand = new OpenSettingsCommand(m_models); DenoiseImageCommand = new SaveDenoisedScreenshotCommand(m_models); RenderAnimatedSequenceCommand = new RenderSequenceCommand(m_models, 0, false, true); KeyGestures = new KeyGestureViewModel(models); }