Exemplo n.º 1
0
        public void clicked(int option)
        {
            this.child = option;
            OptionConversationNode onode = ((OptionConversationNode)node);

            if (option == onode.getChildCount()) // Timeout
            {
                // TODO Analytics for timeout
                return;
            }

            if (TrackerAsset.Instance.Started && !string.IsNullOrEmpty(onode.getXApiQuestion()))
            {
                holder.EndTracePending();
                isTracePending = true;
                xAPISuccess    = onode.getLine(option).getXApiCorrect();
                xAPIQuestion   = onode.getXApiQuestion();
                xAPIResponse   = onode.getLine(option).getText().Replace(",", " ");
                trace          = TrackerAsset.Instance.Alternative.Selected(xAPIQuestion, xAPIResponse, AlternativeTracker.Alternative.Question);
                Game.Instance.GameState.BeginChangeAmbit(trace);
                trace.Result.Duration = Time.realtimeSinceStartup - startTime;
                trace.SetPartial();
                Game.Instance.OnActionCanceled += ActionCancelled;
            }
        }
Exemplo n.º 2
0
 protected override void Execute()
 {
     if (TrackerAsset.Instance.Started)
     {
         trace = TrackerAsset.Instance.GameObject.Interacted(Element, GameObjectTracker.TrackedGameObject.GameObject);
         trace.SetPartial();
         Game.Instance.GameState.BeginChangeAmbit(trace);
     }
     base.Execute();
 }
Exemplo n.º 3
0
 protected override void Execute()
 {
     if (TrackerAsset.Instance.Started)
     {
         trace = TrackerExtension.Movement.Exited(Element, latLonOnExecute);
         trace.SetPartial();
         Game.Instance.GameState.BeginChangeAmbit(trace);
     }
     latLonOnExecute = LatLon;
     base.Execute();
 }
Exemplo n.º 4
0
 protected override void Execute()
 {
     if (NavigationController.Instance)
     {
         NavigationController.Instance.SomethingReached(Holder);
     }
     if (TrackerAsset.Instance.Started)
     {
         trace = TrackerExtension.Movement.Entered(Element, latLonOnExecute);
         trace.SetPartial();
         Game.Instance.GameState.BeginChangeAmbit(trace);
     }
     latLonOnExecute = LatLon;
     base.Execute();
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
        public void ElementInteracted(bool finished, Element element, Core.Action action)
        {
            if (element == null || !TrackerAsset.Instance.Started)
            {
                return;
            }

            if (!finished)
            {
                if (trace != null)
                {
                    Debug.LogError("An interaction has been made while another element is being interacted!!");
                }

                if (element is NPC)
                {
                    trace = TrackerAsset.Instance.GameObject.Interacted(element.getId(), GameObjectTracker.TrackedGameObject.Npc);
                }
                else if (element is Item)
                {
                    trace = TrackerAsset.Instance.GameObject.Interacted(element.getId(), GameObjectTracker.TrackedGameObject.Item);
                }
                else if (element is ActiveArea)
                {
                    trace = TrackerAsset.Instance.GameObject.Interacted(element.getId(), GameObjectTracker.TrackedGameObject.Item);
                }
                else
                {
                    trace = TrackerAsset.Instance.GameObject.Interacted(element.getId(), GameObjectTracker.TrackedGameObject.GameObject);
                }
                trace.SetPartial();
                Game.Instance.GameState.BeginChangeAmbit(trace);
                //Game.Instance.OnActionCanceled += ActionCanceled;

                UpdateElementsInteracted(element, action.getType().ToString(), element.getId());
            }
            else
            {
                string actionType = string.Empty;
                switch (action.getType())
                {
                case Core.Action.CUSTOM: actionType = (action as CustomAction).getName(); break;

                case Core.Action.CUSTOM_INTERACT: actionType = (action as CustomAction).getName(); break;

                case Core.Action.DRAG_TO: actionType = "drag_to"; break;

                case Core.Action.EXAMINE: actionType = "examine"; break;

                case Core.Action.GIVE_TO: actionType = "give_to"; break;

                case Core.Action.GRAB: actionType = "grab"; break;

                case Core.Action.TALK_TO: actionType = "talk_to"; break;

                case Core.Action.USE: actionType = "use"; break;

                case Core.Action.USE_WITH: actionType = "use_with"; break;
                }

                if (!string.IsNullOrEmpty(action.getTargetId()))
                {
                    TrackerAsset.Instance.setVar("action_target", action.getTargetId());
                }
                if (!string.IsNullOrEmpty(actionType))
                {
                    TrackerAsset.Instance.setVar("action_type", actionType);
                }

                Game.Instance.GameState.EndChangeAmbitAsExtensions(trace);
                trace.Completed();
                trace = null;
            }
        }