示例#1
0
        public void Process()
        {
            Animator animator;

            if (!TargetActor.GetActorAnimator(out animator))
            {
                throw new Exception("Error while playing the dialog: you are trying to set the value of an animator parameter, " +
                                    "but the actor can't access to it's animator.");
            }

            switch (Variable.Type)
            {
            case AnimatorVariableType.BOOL:
                animator.SetBool(Variable.Name, Variable.GetValueAs <bool>());
                break;

            case AnimatorVariableType.FLOAT:
                animator.SetFloat(Variable.Name, Variable.GetValueAs <float>());
                break;

            case AnimatorVariableType.INT:
                animator.SetInteger(Variable.Name, Variable.GetValueAs <int>());
                break;

            case AnimatorVariableType.TRIGGER:
                animator.SetTrigger(Variable.Name);
                break;
            }
        }
        public int GetVariableAsInteger()
        {
            Animator animator;

            if (TargetActor.GetActorAnimator(out animator))
            {
                return(animator.GetInteger(VariableName));
            }
            throw new Exception("Error while playing the dialog: you are trying to get the value of an animator parameter, " +
                                "but the actor can't access to it's animator.");
        }