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);
        }
Example #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);
        }
    }
        void OnActionEnd(bool success)
        {
            if (success)
            {
                status = Status.Success;
                DLGTree.Continue();
                return;
            }

            status = Status.Failure;
            DLGTree.Stop(false);
        }
 void OnStatementFinish()
 {
     count++;
     if (count < textsCount)
     {
         DLGTree.EnterNode(this);
     }
     else
     {
         count  = 0;
         status = Status.Success;
         DLGTree.Continue();
     }
 }
Example #5
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);
        }
        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();
            }
        }
        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);
        }
        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);
        }
Example #9
0
 void OnFlowScriptFinish(bool success)
 {
     status = success ? Status.Success : Status.Failure;
     DLGTree.Continue(success ? 0 : 1);
 }
Example #10
0
 void OnSubDialogueFinish(bool success)
 {
     this.TryReadAndUnbindMappedVariables();
     status = success ? Status.Success : Status.Failure;
     DLGTree.Continue(success ? 0 : 1);
 }
Example #11
0
 void OnStatementFinish()
 {
     status = Status.Success;
     DLGTree.Continue();
 }
Example #12
0
 void OnSubDialogueFinish(bool success)
 {
     status = success? Status.Success : Status.Failure;
     DLGTree.Continue(success? 0 : 1);
 }