예제 #1
0
 protected override Status OnExecute()
 {
     DLGTree.currentNode = this;
     status = (Status)endState;
     DLGTree.StopGraph();
     return(status);
 }
예제 #2
0
        private void OnActionEnd(System.ValueType success)
        {
            if ((bool)success)
            {
                Continue();
                return;
            }

            status = Status.Failure;
            DLGTree.StopGraph();
        }
예제 #3
0
        protected override Status OnExecute()
        {
            if (!finalActor)
            {
                DLGTree.StopGraph();
                return(Error("Actor not found"));
            }

            DLGTree.currentNode = this;
            var finalStatement = statement.BlackboardReplace(finalBlackboard);

            finalActor.Say(finalStatement, Continue);
            return(Status.Running);
        }
예제 #4
0
        protected void Continue()
        {
            status = Status.Success;
            if (!DLGTree.isRunning)
            {
                return;
            }

            if (outConnections.Count == 0)
            {
                DLGTree.StopGraph();
                return;
            }

            outConnections[0].Execute(finalActor, finalBlackboard);
        }
예제 #5
0
        protected override Status OnExecute()
        {
            if (!nestedDLG)
            {
                DLGTree.StopGraph();
                return(Error("No Nested Dialogue Tree assigned!"));
            }


            DLGTree.currentNode = this;

            CopyActors();

            nestedDLG.StartGraph(finalActor, finalBlackboard, Continue);
            return(Status.Running);
        }
예제 #6
0
        protected override Status OnExecute()
        {
            if (outConnections.Count == 0)
            {
                DLGTree.StopGraph();
                return(Error("There are no connections to the Multiple Choice Node!"));
            }

            if (!finalActor)
            {
                DLGTree.StopGraph();
                return(Error("Actor not found"));
            }

            DLGTree.currentNode = this;

            Dictionary <Statement, int> finalOptions = new Dictionary <Statement, int>();

            for (int i = 0; i < outConnections.Count; i++)
            {
                if ((outConnections[i] as ConditionalConnection).CheckCondition(finalActor, finalBlackboard))
                {
                    var finalStatement = possibleOptions[i].statement.BlackboardReplace(finalBlackboard);
                    finalOptions[finalStatement] = i;
                }
            }

            if (finalOptions.Count == 0)
            {
                Debug.Log("Multiple Choice Node has no available options. Dialogue Ends");
                DLGTree.StopGraph();
                return(Status.Failure);
            }

            if (availableTime > 0)
            {
                StartCoroutine(CountDown());
            }

            EventHandler.Dispatch(DLGEvents.OnDialogueOptions, new DialogueOptionsInfo(finalOptions, availableTime, OnOptionSelected));

            return(Status.Running);
        }
예제 #7
0
        protected override Status OnExecute()
        {
            if (!finalActor)
            {
                DLGTree.StopGraph();
                return(Error("Actor not found"));
            }

            if (!action)
            {
                OnActionEnd(true);
                return(Status.Success);
            }

            DLGTree.currentNode = this;

            status = Status.Running;
            action.ExecuteAction(finalActor, finalBlackboard, OnActionEnd);
            return(status);
        }
예제 #8
0
        protected override Status OnExecute()
        {
            if (outConnections.Count == 0)
            {
                DLGTree.StopGraph();
                return(Error("There are no connections."));
            }

            if (!finalActor)
            {
                DLGTree.StopGraph();
                return(Error("Actor not found"));
            }

            if (!condition)
            {
                Debug.LogWarning("No Condition on Dialoge Condition Node ID " + ID);
                outConnections[0].Execute(finalActor, finalBlackboard);
                return(Status.Success);
            }

            if (condition.CheckCondition(finalActor, finalBlackboard))
            {
                outConnections[0].Execute(finalActor, finalBlackboard);
                return(Status.Success);
            }

            if (outConnections.Count == 2)
            {
                outConnections[1].Execute(finalActor, finalBlackboard);
                return(Status.Failure);
            }

            graph.StopGraph();
            return(Status.Success);
        }