protected override Status OnExecute(Component agent, IBlackboard bb)
        {
            if (outConnections.Count == 0)
            {
                return(Error("There are no connections to the Multiple Choice Node!"));
            }

            var finalOptions = new Dictionary <IStatement, int>();

            for (var i = 0; i < availableChoices.Count; i++)
            {
                var condition = availableChoices[i].condition;
                if (condition == null || condition.CheckCondition(finalActor.transform, bb))
                {
                    var tempStatement = availableChoices[i].statement.BlackboardReplace(bb);
                    finalOptions[tempStatement] = i;
                }
            }

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

            var optionsInfo = new MultipleChoiceRequestInfo(finalActor, finalOptions, availableTime, OnOptionSelected);

            optionsInfo.showLastStatement = inConnections.Count > 0 && inConnections[0].sourceNode is StatementNode;
            DialogueTree.RequestMultipleChoices(optionsInfo);
            return(Status.Running);
        }
Пример #2
0
    protected override Status OnExecute(Component agent, IBlackboard bb)
    {
        if (outConnections.Count == 0)
        {
            return(Error("There are no connections on the Dialogue Condition Node"));
        }

        switch (mode)
        {
        case MODE.MOD:  count = (count + 1) % maxOutConnections; break;

        case MODE.LIMIT_TO_MAX: count++; if (count > outConnections.Count - 1)
            {
                count = outConnections.Count - 1;
            }
            break;
        }

        if (count < outConnections.Count)
        {
            DLGTree.Continue(count);
            return(Status.Success);
        }
        else
        {
            DLGTree.Stop(false);
            return(Status.Failure);
        }
    }
Пример #3
0
 protected override Status OnExecute()
 {
     DLGTree.currentNode = this;
     status = (Status)endState;
     DLGTree.StopGraph();
     return(status);
 }
        protected override Status OnExecute(Component agent, IBlackboard blackboard)
        {
            successIndeces = new List <int>();
            for (var i = 0; i < outConnections.Count; i++)
            {
                var condition = childOptions[i].condition;
                if (condition == null || condition.CheckOnce(finalActor.transform, blackboard))
                {
                    successIndeces.Add(i);
                }
            }

            var probability = Random.Range(0f, GetTotal());

            for (var i = 0; i < outConnections.Count; i++)
            {
                if (!successIndeces.Contains(i))
                {
                    continue;
                }

                if (probability > childOptions[i].weight.value)
                {
                    probability -= childOptions[i].weight.value;
                    continue;
                }

                DLGTree.Continue(i);
                return(Status.Success);
            }

            return(Status.Failure);
        }
Пример #5
0
 protected override Status OnExecute(Component agent, IBlackboard bb)
 {
     if (target == null)
     {
         return(Error("Target Node of Jumper node is null"));
     }
     DLGTree.EnterNode(target);
     return(Status.Success);
 }
Пример #6
0
        private void OnActionEnd(System.ValueType success)
        {
            if ((bool)success)
            {
                Continue();
                return;
            }

            status = Status.Failure;
            DLGTree.StopGraph();
        }
Пример #7
0
        void OnActionEnd(bool success)
        {
            if (success)
            {
                status = Status.Success;
                DLGTree.Continue();
                return;
            }

            status = Status.Failure;
            DLGTree.Stop(false);
        }
Пример #8
0
 void OnStatementFinish()
 {
     count++;
     if (count < textsCount)
     {
         DLGTree.EnterNode(this);
     }
     else
     {
         count  = 0;
         status = Status.Success;
         DLGTree.Continue();
     }
 }
Пример #9
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);
        }
Пример #10
0
        protected void Continue()
        {
            status = Status.Success;
            if (!DLGTree.isRunning)
            {
                return;
            }

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

            outConnections[0].Execute(finalActor, finalBlackboard);
        }
Пример #11
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);
        }
        void OnOptionSelected(int index)
        {
            status = Status.Success;

            System.Action Finalize = () => { DLGTree.Continue(index); };

            if (saySelection)
            {
                var tempStatement = availableChoices[index].statement.BlackboardReplace(graphBlackboard);
                var speechInfo    = new SubtitlesRequestInfo(finalActor, tempStatement, Finalize);
                DialogueTree.RequestSubtitles(speechInfo);
            }
            else
            {
                Finalize();
            }
        }
Пример #13
0
        protected override Status OnExecute(Component agent, IBlackboard bb)
        {
            if (outConnections.Count == 0)
            {
                return(Error("There are no connections on the Dialogue Condition Node"));
            }

            if (condition == null)
            {
                return(Error("There is no Conidition on the Dialoge Condition Node"));
            }

            var isSuccess = condition.CheckCondition(finalActor.transform, graphBlackboard);

            DLGTree.Continue(isSuccess? 0 : 1);
            return(Status.Success);
        }
Пример #14
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);
        }
Пример #15
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);
        }
        protected override Status OnExecute(Component agent, IBlackboard bb)
        {
            if (outConnections.Count == 0)
            {
                return(Error("There are no connections on the Dialogue Condition Node"));
            }

            for (var i = 0; i < outConnections.Count; i++)
            {
                if (conditions[i] == null || conditions[i].CheckOnce(finalActor.transform, graphBlackboard))
                {
                    DLGTree.Continue(i);
                    return(Status.Success);
                }
            }

            ParadoxNotion.Services.Logger.LogWarning("No condition is true. Dialogue Ends.", LogTag.EXECUTION, this);
            DLGTree.Stop(false);
            return(Status.Failure);
        }
        protected override Status OnExecute(Component agent, IBlackboard bb)
        {
            if (outConnections.Count == 0)
            {
                return(Error("There are no connections on the Dialogue Condition Node"));
            }

            for (var i = 0; i < outConnections.Count; i++)
            {
                if (conditions[i] == null || conditions[i].CheckCondition(finalActor.transform, graphBlackboard))
                {
                    DLGTree.Continue(i);
                    return(Status.Success);
                }
            }

            //Debug.LogWarning("No condition is true. Dialogue Stops");
            DLGTree.Stop(false);
            return(Status.Failure);
        }
Пример #18
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);
        }
Пример #19
0
 void OnFlowScriptFinish(bool success)
 {
     status = success ? Status.Success : Status.Failure;
     DLGTree.Continue(success ? 0 : 1);
 }
Пример #20
0
 void OnSubDialogueFinish(bool success)
 {
     status = success? Status.Success : Status.Failure;
     DLGTree.Continue(success? 0 : 1);
 }
Пример #21
0
 protected override Status OnExecute(Component agent, IBlackboard bb)
 {
     status = finishState? Status.Success : Status.Failure;
     DLGTree.Stop(finishState);
     return(status);
 }
Пример #22
0
 protected override Status OnExecute(Component agent, IBlackboard bb)
 {
     status = (Status)endState;
     DLGTree.Stop();
     return(status);
 }
Пример #23
0
 void OnStatementFinish()
 {
     status = Status.Success;
     DLGTree.Continue();
 }
Пример #24
0
 protected override Status OnExecute(Component agent, IBlackboard bb)
 {
     status = (Status)finishState;
     DLGTree.Stop(finishState == CompactStatus.Success ? true : false);
     return(status);
 }
Пример #25
0
 void OnSubDialogueFinish(bool success)
 {
     this.TryReadAndUnbindMappedVariables();
     status = success ? Status.Success : Status.Failure;
     DLGTree.Continue(success ? 0 : 1);
 }