protected override void OnNodeInspectorGUI()
        {
            if (GUILayout.Button("Set Target Node"))
            {
                UnityEditor.GenericMenu.MenuFunction2 Selected = (object o) =>
                {
                    _targetNode = (DTNode)o;
                };

                var menu = new UnityEditor.GenericMenu();
                foreach (DTNode node in graph.allNodes)
                {
                    if (node != this)
                    {
                        menu.AddItem(new GUIContent("#" + node.ID.ToString()), false, Selected, node);
                    }
                }
                menu.ShowAsContext();
                Event.current.Use();
            }

            if (_targetNode != null && GUILayout.Button("Select Target Node"))
            {
                NodeCanvas.Editor.GraphEditorUtility.activeElement = _targetNode;
            }
        }
        protected override void OnNodeInspectorGUI()
        {
            if (GUILayout.Button("Set GO TO Target"))
            {
                UnityEditor.GenericMenu.MenuFunction2 Selected = (object o) => {
                    _targetNode = (DTNode)o;
                };

                var menu = new UnityEditor.GenericMenu();
                foreach (DTNode node in graph.allNodes)
                {
                    if (node != this)
                    {
                        menu.AddItem(new GUIContent(node.name), false, Selected, node);
                    }
                }
                menu.ShowAsContext();
                Event.current.Use();
            }

            if (_targetNode != null && GUILayout.Button("Select Target Node"))
            {
                Graph.currentSelection = _targetNode;
            }
        }
Example #3
0
 ///Enters the provided node
 public void EnterNode(DTNode node)
 {
     currentNode = node;
     currentNode.Reset(false);
     if (currentNode.Execute(agent, blackboard) == Status.Error)
     {
         Stop(false);
     }
 }
Example #4
0
        protected override void OnGraphUnpaused()
        {
            currentNode = currentNode != null? currentNode : (DTNode)primeNode;
            EnterNode(currentNode);

            Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Resumed '{0}'", this.name));
            if (OnDialogueStarted != null)
            {
                OnDialogueStarted(this);
            }
        }
Example #5
0
        protected override void OnGraphStoped()
        {
            currentNode     = null;
            currentDialogue = null;

            Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Finished '{0}'", this.name));
            if (OnDialogueFinished != null)
            {
                OnDialogueFinished(this);
            }
        }
Example #6
0
        protected override void OnGraphStoped()
        {
            endState        = currentNode != null? (EndState)currentNode.status : EndState.Success;
            currentNode     = null;
            currentDialogue = null;

            Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Finished '{0}'", this.name));
            if (OnDialogueFinished != null)
            {
                OnDialogueFinished(this);
            }
        }
Example #7
0
        protected override void OnGraphStarted()
        {
            previousDialogue = currentDialogue;
            currentDialogue  = this;

            Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Started '{0}'", this.name));
            if (OnDialogueStarted != null)
            {
                OnDialogueStarted(this);
            }

            if (!(agent is IDialogueActor))
            {
                Debug.Log("<b>DialogueTree:</b> INSTIGATOR agent used in DialogueTree does not implement IDialogueActor. A dummy actor will be used.");
            }

            currentNode = currentNode != null? currentNode : (DTNode)primeNode;
            EnterNode(currentNode);
        }
        protected override void OnNodeInspectorGUI()
        {
            if (GUILayout.Button("Set GO TO Target")){

                UnityEditor.GenericMenu.MenuFunction2 Selected = (object o)=> {
                    _targetNode = (DTNode)o;
                };

                var menu = new UnityEditor.GenericMenu();
                foreach (DTNode node in graph.allNodes){
                    if (node != this)
                        menu.AddItem( new GUIContent(node.name), false, Selected, node );
                }
                menu.ShowAsContext();
                Event.current.Use();
            }

            if (_targetNode != null && GUILayout.Button("Select Target Node")){
                Graph.currentSelection = _targetNode;
            }
        }
Example #9
0
        ////

        protected override void OnGraphStarted()
        {
            if (currentDialogue != null)
            {
                Debug.LogWarning(string.Format("<b>DialogueTree:</b> Another Dialogue Tree named '{0}' is already running and will be stoped before starting new one '{1}'", currentDialogue.name, this.name));
                currentDialogue.Stop(true);
            }

            currentDialogue = this;

            Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Started '{0}'", this.name));
            if (OnDialogueStarted != null)
            {
                OnDialogueStarted(this);
            }

            if (!(agent is IDialogueActor))
            {
                Debug.Log("<b>DialogueTree:</b> INSTIGATOR agent used in DialogueTree does not implement IDialogueActor. A dummy actor will be used.");
            }

            currentNode = currentNode != null? currentNode : (DTNode)primeNode;
            EnterNode(currentNode);
        }
		protected override void OnGraphStoped(){

			endState = currentNode != null? (EndState)currentNode.status : EndState.Success;
			currentNode = null;
			currentDialogue = null;

			Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Finished '{0}'", this.name));
			if (OnDialogueFinished != null)
				OnDialogueFinished(this);
		}
		////

		protected override void OnGraphStarted(){

			if (currentDialogue != null){
				Debug.LogWarning(string.Format("<b>DialogueTree:</b> Another Dialogue Tree named '{0}' is already running and will be stoped before starting new one '{1}'", currentDialogue.name, this.name ));
				currentDialogue.Stop();
			}

			currentDialogue = this;

			Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Started '{0}'", this.name));
			if (OnDialogueStarted != null)
				OnDialogueStarted(this);

			if ( !(agent is IDialogueActor) ){
				Debug.Log("<b>DialogueTree:</b> INSTIGATOR agent used in DialogueTree does not implement IDialogueActor. A dummy actor will be used.");
			}

			currentNode = currentNode != null? currentNode : (DTNode)primeNode;
			EnterNode( currentNode );
		}
		///Enters the provided node
		public void EnterNode(DTNode node){
			currentNode = node;
			currentNode.Reset(false);
			if (currentNode.Execute(agent, blackboard) == Status.Error ){
				Stop();
			}
		}