Пример #1
0
        public override string ErrorCheck()
        {
            Variable variable = null;

            if (IsGlobal.Value)
            {
                variable = DialogueSystem.GetGlobalVariable(VariableName.Value);
            }
            else
            {
                var go = Fsm.GetOwnerDefaultTarget(Actor);
                if (go == null)
                {
                    return("Actor is needed for getting a local variable!");
                }
                DialogueBehaviour b = go.GetComponent <DialogueBehaviour>();
                variable = b.GetLocalVariable(VariableName.Value);
            }

            // Variable doesn't exists
            if (variable == null)
            {
                return(VariableName.Value + " doesn't exists in the " + ((IsGlobal.Value) ? "Dialogue Editor Global Variables" : ""));
            }

            // Variable type is not the right one
            if (!FsmVariableUtils.CheckType(variable, typeof(T)))
            {
                return("The value type should be " + variable.type);
            }

            return(base.ErrorCheck());
        }
Пример #2
0
 public override void OnEnter()
 {
     if (IsGlobal.Value)
     {
         var variable = DialogueSystem.GetGlobalVariable(VariableName.Value);
         FsmVariableUtils.SetFsmVariable(result, variable);
     }
     else
     {
         var go = Fsm.GetOwnerDefaultTarget(Actor);
         if (go != null)
         {
             DialogueBehaviour b = go.GetComponent <DialogueBehaviour>();
             var variable        = b.GetLocalVariable(VariableName.Value);
             FsmVariableUtils.SetFsmVariable(result, variable);
         }
     }
     Finish();
 }