public IRunnerChapterTarget RunTarget(string scene_id, int transition_time = 0, TransitionType transition_type = 0, Interactuable notifyObject = null, bool trace = true) { Debug.Log("Run target: " + scene_id); GUIManager.Instance.ShowHand(false); MenuMB.Instance.hide(true); IChapterTarget target = GameState.GetChapterTarget(scene_id); var transition = new Transition(); transition.setTime(transition_time); transition.setType(transition_type); transitionManager.PrepareTransition(transition); if (runnerTarget != null && runnerTarget.Data == target && scene_id == GameState.CurrentTarget) { runnerTarget.RenderScene(); } else { if (runnerTarget != null) { runnerTarget.Destroy(); } // Here we connect with the IChapterTargetFactory and create an IRunnerChapterTarget runnerTarget = RunnerChapterTargetFactory.Instance.Instantiate(target); runnerTarget.Data = target; GameState.CurrentTarget = target.getId(); } if (trace && OnTargetChanged != null) { OnTargetChanged(target); } waitingRunTarget = true; if (notifyObject != null) { executeStack.Push(new KeyValuePair <Interactuable, ExecutionEvent>(notifyObject, null)); } uAdventureRaycaster.Instance.Override = this.gameObject; return(runnerTarget); }
private IEnumerator RunTarget(string target) { var mb = runner as MonoBehaviour; if (mb != null && mb) { DestroyImmediate(runner.gameObject); runner = null; } else { yield return(SceneManager.LoadSceneAsync("Simva", LoadSceneMode.Additive)); } runner = SimvaSceneHandler.Instantiate(target); runner.RenderScene(); yield return(new WaitUntil(() => runner.IsReady)); }
public IRunnerChapterTarget RunTarget(string scene_id, int transition_time = 0, int transition_type = 0) { MenuMB.Instance.hide(true); if (runnerTarget != null) { runnerTarget.Destroy(transition_time / 1000f); } // Here we connect with the IChapterTargetFactory and create an IRunnerChapterTarget IChapterTarget target = GameState.getChapterTarget(scene_id); runnerTarget = RunnerChapterTargetFactory.Instance.Instantiate(target); runnerTarget.Data = target; trackSceneChange(target); GameState.CurrentTarget = target.getId(); return(runnerTarget); }
public IRunnerChapterTarget RunTarget(string scene_id, int transition_time = 0, TransitionType transition_type = 0, Interactuable notifyObject = null, bool trace = true) { Debug.Log("Run target: " + scene_id); if (GUIManager.Instance) { GUIManager.Instance.ShowHand(false); } if (MenuMB.Instance) { MenuMB.Instance.hide(true); } IChapterTarget target = GameState.GetChapterTarget(scene_id); if (TransitionManager != null) { var transition = new Transition(); transition.setTime(transition_time); transition.setType(transition_type); TransitionManager.PrepareTransition(transition); } if (runnerTarget != null && runnerTarget.Data == target && scene_id == GameState.CurrentTarget) { runnerTarget.RenderScene(); waitingRunTarget = true; } else { waitingTargetDestroy = true; System.Action runTarget = () => { waitingTargetDestroy = false; waitingRunTarget = true; if (trace) { GameState.CurrentTarget = target.getId(); } runnerTarget.RenderScene(); if (trace && OnTargetChanged != null) { OnTargetChanged(target); } }; var oldTarget = runnerTarget; // Here we connect with the IChapterTargetFactory and create an IRunnerChapterTarget runnerTarget = RunnerChapterTargetFactory.Instance.Instantiate(target); runnerTarget.Data = target; Debug.Log("Target gameobject: " + runnerTarget.gameObject); DontDestroyOnLoad(runnerTarget.gameObject); Debug.Log("Target creado: " + runnerTarget); System.Action afterChapterLoad = () => { if (oldTarget != null) { oldTarget.Destroy(0f, runTarget); } else { runTarget(); } }; if (loadedChapter != GameState.CurrentChapter) { LoadChapter(GameState.CurrentChapter) .Then(() => { loadedChapter = GameState.CurrentChapter; afterChapterLoad(); }) .Catch(ex => { Debug.LogError(ex); }); } else { afterChapterLoad(); } } if (notifyObject != null) { executeStack.Push(new KeyValuePair <Interactuable, ExecutionEvent>(notifyObject, null)); } if (uAdventureRaycaster.Instance) { uAdventureRaycaster.Instance.Override = this.gameObject; } return(runnerTarget); }
public void elementInteracted(IRunnerChapterTarget interactuable) { // TODO // implement completable changes on interaction }