Exemplo n.º 1
0
        public void showOptions(ConversationNodeHolder options)
        {
            var optionsNode = options.getNode() as OptionConversationNode;

            if (optionsNode != null)
            {
                // Disable the UI interactivity
                uAdventureRaycaster.Instance.enabled = false;
                InventoryManager.Instance.Show       = false;

                // Enable blurred background
                blur = GameObject.Instantiate(Blur_Prefab);
                blur.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, Camera.main.transform.position.z + 1);

                // Order shuffeling when node is configured for random
                this.order = Enumerable.Range(0, optionsNode.getLineCount()).ToList();
                if (optionsNode.isRandom())
                {
                    this.order.Shuffle();
                }
                this.guioptions = options;
                this.guistate   = GUIState.ANSWERS_MENU;

                // Timeout option
                if (optionsNode.Timeout > 0 && ConditionChecker.check(optionsNode.TimeoutConditions))
                {
                    this.doTimeOut   = true;
                    this.elapsedTime = 0;
                }
                else
                {
                    this.doTimeOut = false;
                }
            }
        }
        public bool execute()
        {
            bool forcewait = false;

            if (current == null)
            {
                current = nodes[0];
            }

            while (!forcewait)
            {
                if (current.execute())
                {
                    forcewait = true;
                    break;
                }
                else
                {
                    current = current.getChild();
                    if (current == null)
                    {
                        break;
                    }
                }
            }

            if (!forcewait)
            {
                this.current = null;
            }

            return(forcewait);
        }
Exemplo n.º 3
0
 public void showOptions(ConversationNodeHolder options)
 {
     if (options.getNode().getType() == ConversationNodeViewEnum.OPTION)
     {
         blur = GameObject.Instantiate(Blur_Prefab);
         blur.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, Camera.main.transform.position.z + 1);
         this.guioptions         = options;
         this.guistate           = guiState.ANSWERS_MENU;
     }
 }
Exemplo n.º 4
0
        public bool execute()
        {
            bool forcewait = false;

            if (current == null)
            {
                current = nodes[0];
                if (TrackerAsset.Instance.Started)
                {
                    TrackerAsset.Instance.Completable.Initialized(conversation.getId(), CompletableTracker.Completable.DialogNode);
                }
            }

            while (!forcewait)
            {
                if (current.execute())
                {
                    forcewait = true;
                    break;
                }
                else
                {
                    ConversationNodeHolder child = current.getChild();
                    if (current.TracePending)
                    {
                        // If the current node has a pending trace
                        // We end the previous trace pending
                        EndTracePending();

                        // And we put this into pending
                        tracePendingNode = current;
                    }

                    current = child;
                    if (current == null)
                    {
                        // When the conversation is over if there's a
                        // pending node, we end it
                        EndTracePending();
                        if (TrackerAsset.Instance.Started)
                        {
                            TrackerAsset.Instance.Completable.Completed(conversation.getId(), CompletableTracker.Completable.DialogNode);
                        }
                        break;
                    }
                }
            }

            if (!forcewait)
            {
                this.current = null;
            }

            return(forcewait);
        }
Exemplo n.º 5
0
        public bool execute()
        {
            bool forcewait = false;

            if (current == null)
            {
                current = nodes[0];
            }

            while (!forcewait)
            {
                if (current.execute())
                {
                    forcewait = true;
                    break;
                }
                else
                {
                    ConversationNodeHolder child = current.getChild();
                    if (current.TracePending)
                    {
                        // If the current node has a pending trace
                        // We end the previous trace pending
                        if (tracePendingNode != null)
                        {
                            tracePendingNode.EndTrace();
                        }

                        // And we put this into pending
                        tracePendingNode = current;
                    }

                    current = child;
                    if (current == null)
                    {
                        // When the conversation is over if there's a
                        // pending node, we end it
                        if (tracePendingNode != null)
                        {
                            tracePendingNode.EndTrace();
                        }
                        break;
                    }
                }
            }

            if (!forcewait)
            {
                this.current = null;
            }

            return(forcewait);
        }
Exemplo n.º 6
0
        public bool execute()
        {
            bool forcewait = false;

            if (current == null)
            {
                current = nodes[0];
            }

            while (!forcewait)
            {
                if (current.execute())
                {
                    forcewait = true;
                    break;
                }
                else
                {
                    ConversationNodeHolder child = current.getChild();
                    if (current.TracePending)
                    {
                        if (tracePendingNode != null)
                        {
                            tracePendingNode.EndTrace();
                        }

                        tracePendingNode = current;
                    }

                    current = child;
                    if (current == null)
                    {
                        if (tracePendingNode != null)
                        {
                            tracePendingNode.EndTrace();
                        }
                        break;
                    }
                }
            }

            if (!forcewait)
            {
                this.current = null;
            }

            return(forcewait);
        }