public IRunnerChapterTarget Instantiate(IChapterTarget modelObject) { GameObject form = null; switch (modelObject.getId()) { case "Simva.Login": form = GameObject.Instantiate(Resources.Load <GameObject>("SimvaLogin")); break; case "Simva.Survey": form = GameObject.Instantiate(Resources.Load <GameObject>("SimvaSurvey")); break; case "Simva.End": form = GameObject.Instantiate(Resources.Load <GameObject>("SimvaEnd")); break; } if (form != null) { var runner = form.GetComponent <IRunnerChapterTarget>(); runner.Data = modelObject; return(runner); } return(null); }
private void Init() { // First run targetOnExit = Game.Instance.GameState.GetChapterTarget(Game.Instance.GameState.CurrentTarget); Game.Instance.GameState.BeginChangeAmbit(); exitEffects = toRun.ExitMb.GetExitEffects(out exits); }
public IRunnerChapterTarget Instantiate(IChapterTarget modelObject) { var s = GameObject.Instantiate(prefab).GetComponent <SceneMB>(); s.gameObject.GetComponent <Transform>().localPosition = new Vector2(0f, 0f); return(s); }
public bool Update(IChapterTarget target) { if (!reached && type == Completable.Milestone.MilestoneType.SCENE && id == target.getId()) { reached = true; } return(reached); }
public void SwitchToLastTarget() { IChapterTarget last = GameState.PreviousChapterTarget; if (last != null) { RunTarget(last.getId(), 1000, TransitionType.FadeIn); } }
public void TargetChanged(IChapterTarget target) { if (!string.IsNullOrEmpty(target.getXApiClass()) && target.getXApiClass() == "accesible") { TrackerAsset.Instance.Accessible.Accessed(target.getId(), ExParsers.ParseEnum <AccessibleTracker.Accessible>(target.getXApiType())); TrackerAsset.Instance.Flush(); } UpdateCompletables(completableController => completableController.UpdateMilestones(target)); }
private void trackSceneChange(IChapterTarget target) { if (!string.IsNullOrEmpty(target.getXApiClass()) && target.getXApiClass() == "accesible") { TrackerAsset.Instance.Accessible.Accessed(target.getId(), ExParsers.ParseEnum <AccessibleTracker.Accessible>(target.getXApiType())); TrackerAsset.Instance.Flush(); } CompletablesController.Instance.TargetChanged(target); }
public bool updateMilestones(IChapterTarget target) { bool reached = false; foreach (Milestone m in milestones) { reached = m.Update(target) || reached; } return(reached); }
private void TraceExit(bool exited, IChapterTarget targetOnExit) { var ed = area.Element as Exit; // ALTERNATIVE if ("alternative".Equals(targetOnExit.getXApiClass(), IgnoreCase)) { var parsedType = (AlternativeTracker.Alternative)Enum.Parse(typeof(AlternativeTracker.Alternative), targetOnExit.getXApiType(), true); if (ConditionChecker.check(ed.getConditions())) { if (targetOnExit.getXApiType() == "menu") { TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), ed.getNextSceneId(), parsedType); } else { TrackerAsset.Instance.setSuccess(true); TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), ed.getNextSceneId(), parsedType); } } else { if (targetOnExit.getXApiType() != "menu") { TrackerAsset.Instance.setSuccess(false); TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), "Incorrect", parsedType); } } TrackerAsset.Instance.Flush(); } // ACCESIBLE // If no exited, accesible doesnt matter if (!exited) { return; } // If no destination accesible doesnt matter var destination = Game.Instance.GameState.GetChapterTarget(ed.getNextSceneId()); if (destination == null) { return; } if ("accesible".Equals(destination.getXApiClass(), IgnoreCase)) { var type = ExParsers.ParseDefault(destination.getXApiType(), AccessibleTracker.Accessible.Accessible); TrackerAsset.Instance.Accessible.Accessed(destination.getId(), type); } }
private void Init() { // First run targetOnExit = Game.Instance.GameState.GetChapterTarget(Game.Instance.GameState.CurrentTarget); try { trace = toRun.ExitMb.TraceExit(exits, targetOnExit); trace?.SetPartial(); } catch (Exception ex) { Debug.Log("Error while tracing the exit! (" + ex.Message + ", " + ex.StackTrace + ")"); } Game.Instance.GameState.BeginChangeAmbit(trace); exitEffects = toRun.ExitMb.GetExitEffects(out exits); }
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); }
public void targetChanged(IChapterTarget target) { //Complete if any scene is completed on exit. if (completeOnExit != null) { Tracker.T.completable.Completed(completeOnExit.getId(), CompletableTracker.Completable.Stage, true, completeOnExit.getScore().getScore()); completeOnExit = null; } //Buscamos en nuestra lista de completables si algun completable se completa o progresa al llegar aquí foreach (Completable toComplete in completables) { if (toComplete.getProgress().updateMilestones(target)) { Tracker.T.completable.Progressed(toComplete.getId(), (CompletableTracker.Completable)toComplete.getType(), toComplete.currentProgress()); } if (toComplete.getEnd().Update(target)) { trackCompleted(toComplete); toRemove.Push(toComplete); } } clearToRemove(); //Buscamos en nuestros completables si alguno se inicia con esta escena foreach (Completable completable in completables) { // TODO: // prevent levels overlaping. if (!trackingCompletables.Contains(completable) && completable.getStart().Update(target)) { trackingCompletables.Add(completable); times.Add(completable, DateTime.Now); Tracker.T.completable.Initialized(completable.getId(), (CompletableTracker.Completable)completable.getType()); Tracker.T.completable.Progressed(completable.getId(), (CompletableTracker.Completable)completable.getType(), 0); if (completable.getEnd() == null) { completeOnExit = completable; } } } }
public bool execute() { if (exitEffects == null) { Game.Instance.GameState.BeginChangeAmbit(); targetOnExit = Game.Instance.GameState.GetChapterTarget(Game.Instance.GameState.CurrentTarget); exitEffects = toRun.ExitMb.GetExitEffects(out exit); } var forceWait = exitEffects.execute(); if (!forceWait) { Game.Instance.GameState.EndChangeAmbit(); toRun.ExitMb.TrackExit(exit, targetOnExit); } return(forceWait); }
private void trackSceneChange(IChapterTarget target) { alternative = null; if (!string.IsNullOrEmpty(target.getXApiClass())) { if (target.getXApiClass() == "accesible") { Tracker.T.accessible.Accessed(target.getId(), ParseEnum <AccessibleTracker.Accessible>(target.getXApiType())); } else if (target.getXApiClass() == "alternative") { alternative = target; } } CompletableController.Instance.targetChanged(target); Tracker.T.RequestFlush(); }
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 bool Update(IChapterTarget target) { bool hasBeenUpdated = false; if (!Reached) { switch (Milestone.getType()) { case Completable.Milestone.MilestoneType.SCENE: var isTargetedScene = Milestone.getId() == target.getId(); if (isTargetedScene) { Reached = true; hasBeenUpdated = true; } break; case Completable.Milestone.MilestoneType.ENDING: if (target is Cutscene) { if (((Cutscene)target).isEndScene()) { Reached = true; hasBeenUpdated = true; } } break; default: break; } } return(hasBeenUpdated); }
public bool UpdateMilestones(IChapterTarget target) { if (completed) { return(false); } if (completeOnExit && target.getId() != Start.Milestone.getId()) { completed = true; CompletablesController.Instance.TrackCompleted(this, DateTime.Now - startTime); } else { var wasStarted = Started; completed = UpdateMilestones(milestone => milestone.Update(target)); if (wasStarted != Started && Completable.getEnd() == null) { completeOnExit = true; } } return(completed); }
private TrackerAsset.TrackerEvent TraceExit(bool exited, IChapterTarget targetOnExit) { if (!TrackerAsset.Instance.Started) { return(null); } var ed = area.Element as Exit; // ALTERNATIVE if ("alternative".Equals(targetOnExit.getXApiClass(), IgnoreCase)) { var parsedType = (AlternativeTracker.Alternative)Enum.Parse(typeof(AlternativeTracker.Alternative), targetOnExit.getXApiType(), true); if (ConditionChecker.check(ed.getConditions())) { if (targetOnExit.getXApiType() == "menu") { return(TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), ed.getNextSceneId(), parsedType)); } else { TrackerAsset.Instance.setSuccess(true); return(TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), ed.getNextSceneId(), parsedType)); } } else { if (targetOnExit.getXApiType() != "menu") { TrackerAsset.Instance.setSuccess(false); return(TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), "Incorrect", parsedType)); } } } return(null); }
public bool UpdateMilestones(IChapterTarget target) { if (completed) { return(false); } if (completeOnExit && target.getId() != Start.GetMilestone().getId()) { completed = true; AnalyticsExtension.Instance.TrackCompleted(this, DateTime.Now - startTime); } else { var wasStarted = Started; completed = UpdateMilestones(milestone => milestone.Update(target)); if (wasStarted != Started && GetCompletable().getEnd() == null) { completeOnExit = true; } } return(completed); }
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 TargetChanged(IChapterTarget target) { UpdateCompletables(completableController => completableController.UpdateMilestones(target)); }
public IRunnerChapterTarget Instantiate(IChapterTarget modelObject) { var go = new GameObject("UnitySceneRunner", typeof(UnitySceneRunner)); return(go.GetComponent <UnitySceneRunner>()); }
public IRunnerChapterTarget Instantiate(IChapterTarget modelObject) { var ms = GameObject.Instantiate(mapScenePrefab).GetComponent <MapSceneMB>(); return(ms); }
// Main method public IRunnerChapterTarget Instantiate(IChapterTarget target) { return(getFactories()[target.GetType()].Instantiate(target)); }