コード例 #1
0
        /// <summary>
        /// Executes this node on the specified dialogue state.
        /// </summary>
        public override void PerformNode(DialoguePlayer state)
        {
            int value;

            if (state.IntVariables.TryGetValue(VariableName, out value))
            {
                switch (OperationType)
                {
                case VariableOperationType.Set:
                    state.IntVariables[VariableName] = Value;
                    break;

                case VariableOperationType.Add:
                    state.IntVariables[VariableName] += Value;
                    break;

                case VariableOperationType.Subtract:
                    state.IntVariables[VariableName] -= Value;
                    break;

                default:
                    throw new NotImplementedException(string.Format("VariableOperationType.{0}", OperationType.ToString()));
                }
            }
            else
            {
                Debug.LogWarningFormat("Set Local Variable: node {0} has no int-typed variable '{1}'.", GetDebugName(), VariableName);
            }

            base.PerformNode(state);
        }
コード例 #2
0
        /// <summary>
        /// Performs a user choice on this node, moving to the appropriate next node.
        /// </summary>
        public override void PerformChoice(DialoguePlayer state, int choice)
        {
            if (choice < 0 || choice >= Choices.Length)
            {
                throw new ArgumentOutOfRangeException("choice");
            }
            Choice choiceData = Choices[choice];

            state.MoveToNode(choiceData.Next);
        }
コード例 #3
0
 /// <summary>
 /// Executes this node on the specified dialogue state.
 /// </summary>
 public override void PerformNode(DialoguePlayer state)
 {
     if (state.RandomFloat() < Chance1)
     {
         state.MoveToNode(Branch1);
     }
     else
     {
         state.MoveToNode(Branch2);
     }
 }
コード例 #4
0
 /// <summary>
 /// Executes this node on the specified dialogue state.
 /// </summary>
 public override void PerformNode(DialoguePlayer state)
 {
     if (state.EvaluateCondition(Text))
     {
         state.MoveToNode(BranchTrueNext);
     }
     else
     {
         state.MoveToNode(BranchFalseNext);
     }
 }
コード例 #5
0
        /// <summary>
        /// Executes this node on the specified dialogue state.
        /// </summary>
        public override void PerformNode(DialoguePlayer state)
        {
            if (state.StringVariables.ContainsKey(VariableName))
            {
                state.StringVariables[VariableName] = Value;
            }
            else
            {
                Debug.LogWarningFormat("Set Local Variable: node {0} has no string-typed variable '{1}'.", GetDebugName(), VariableName);
            }

            base.PerformNode(state);
        }
コード例 #6
0
        /// <summary>
        /// Executes this node on the specified dialogue state.
        /// </summary>
        public override void PerformNode(DialoguePlayer state)
        {
            bool value;

            if (state.BoolVariables.TryGetValue(VariableName, out value))
            {
                if (Toggle)
                {
                    state.BoolVariables[VariableName] = !value;
                }
                else
                {
                    state.BoolVariables[VariableName] = Value;
                }
            }
            else
            {
                Debug.LogWarningFormat("Set Local Variable: node {0} has no bool-typed variable '{1}'.", GetDebugName(), VariableName);
            }

            base.PerformNode(state);
        }
コード例 #7
0
        /// <summary>
        /// Executes this node on the specified dialogue state.
        /// </summary>
        public override void PerformNode(DialoguePlayer state)
        {
            state.ExecuteScript(Text);

            base.PerformNode(state);
        }
コード例 #8
0
 /// <summary>
 /// Executes this node on the specified dialogue state.
 /// </summary>
 public override void PerformNode(DialoguePlayer state)
 {
     state.MoveToNode(Next);
 }
コード例 #9
0
 /// <summary>
 /// Executes this node on the specified dialogue state.
 /// </summary>
 public override void PerformNode(DialoguePlayer state)
 {
     // handled by DialoguePlayer.Update
 }
コード例 #10
0
 /// <summary>
 /// Executes this node on the specified dialogue state.
 /// </summary>
 public override void PerformNode(DialoguePlayer state)
 {
     state.PushRepeatNode(this);
 }
コード例 #11
0
 /// <summary>
 /// Performs a user choice on this node, moving to the appropriate next node.
 /// </summary>
 public abstract void PerformChoice(DialoguePlayer state, int choice);
コード例 #12
0
 /// <summary>
 /// Returns true if this choice is enabled.
 /// </summary>
 public bool IsEnabled(DialoguePlayer state)
 {
     return(!IsCondition || state.EvaluateCondition(Condition));
 }
コード例 #13
0
 /// <summary>
 /// Performs a user choice on this node, moving to the appropriate next node.
 /// </summary>
 public override void PerformChoice(DialoguePlayer state, int choice)
 {
     state.MoveToNode(Next);
 }
コード例 #14
0
        /// <summary>
        /// Executes this node on the specified dialogue state.
        /// </summary>
        public override void PerformNode(DialoguePlayer state)
        {
            int randomIndex = state.RandomInt(Branches.Length);

            state.MoveToNode(Branches[randomIndex]);
        }
コード例 #15
0
 /// <summary>
 /// Executes this node on the specified dialogue state.
 /// </summary>
 public override void PerformNode(DialoguePlayer state)
 {
     state.EvaluateCondition(Text);
 }
コード例 #16
0
 /// <summary>
 /// Executes this node on the specified dialogue state.
 /// </summary>
 public override void PerformNode(DialoguePlayer state)
 {
     state.ShowMessage(this);
 }
コード例 #17
0
 /// <summary>
 /// Executes this node on the specified dialogue state.
 /// </summary>
 public abstract void PerformNode(DialoguePlayer state);
コード例 #18
0
 /// <summary>
 /// Returns true if this choice is enabled.
 /// </summary>
 public bool IsEnabled(DialoguePlayer state)
 {
     return(!IsCondition || state.EvaluateCondition(Condition).GetValueOrDefault(false));
 }