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);
        }
Ejemplo n.º 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);
        }
    }
Ejemplo n.º 3
0
        void OnActionEnd(bool success)
        {
            if (success)
            {
                status = Status.Success;
                DLGTree.Continue();
                return;
            }

            status = Status.Failure;
            DLGTree.Stop(false);
        }
        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);
        }
Ejemplo n.º 6
0
 protected override Status OnExecute(Component agent, IBlackboard bb)
 {
     status = (Status)endState;
     DLGTree.Stop();
     return(status);
 }
Ejemplo n.º 7
0
 protected override Status OnExecute(Component agent, IBlackboard bb)
 {
     status = (Status)finishState;
     DLGTree.Stop(finishState == CompactStatus.Success ? true : false);
     return(status);
 }
Ejemplo n.º 8
0
 protected override Status OnExecute(Component agent, IBlackboard bb)
 {
     status = finishState? Status.Success : Status.Failure;
     DLGTree.Stop(finishState);
     return(status);
 }