Exemple #1
0
        protected override float Evaluate(IContext context)
        {
            var a = m_Target.Load(context);
            var b = m_Value.Get(context);

            switch (m_Operator)
            {
            case Operator.Assign: return(b);

            case Operator.Add: return(a + b);

            case Operator.Substract: return(a - b);

            case Operator.Multiply: return(a * b);

            case Operator.Divide: return(a / b);

            case Operator.Min: return(Mathf.Min(a, b));

            case Operator.Max: return(Mathf.Max(a, b));

            default:
                Debug.LogAssertion($"Unkown Operator {m_Operator}");
                return(default);
            }
        }
Exemple #2
0
        protected override bool DoEvaluate(IContext context)
        {
            var a = m_A.Get(context);
            var b = m_B.Get(context);

            switch (m_Operator)
            {
            case Operator.EqualTo: return(a == b);

            case Operator.LessThan: return(a < b);

            case Operator.GreaterThan: return(a > b);

            case Operator.LessThanOrEqualTo: return(a <= b);

            case Operator.GreaterThanOrEqualTo: return(a >= b);

            default:
                Debug.LogAssertion($"Unknown Operator {m_Operator}");
                return(false);
            }
        }
Exemple #3
0
        protected sealed override void ExecuteParameter(IContext context, Animator animator, string parameter)
        {
            var value = m_Value.Get(context);

            animator.SetFloat(parameter, value);
        }