Esempio n. 1
0
    public override float Evaluate()
    {
        float resultValue   = 0;
        bool  hasValidInput = false;

        if (GetParameter(0) != null)
        {
            resultValue   = GetParameter(0).Evaluate();
            hasValidInput = true;
        }

        for (int i = 0; i < nodeCount; ++i)
        {
            MathNode node         = GetNode(i);
            float    currentValue = 0;

            if (node != null)
            {
                currentValue = node.Evaluate();
            }

            if (i == 0 && !hasValidInput)
            {
                resultValue = currentValue;
            }
            else
            {
                resultValue = s_OperationFuncs[m_CurrentOperation](resultValue, currentValue);
            }
        }

        return(resultValue);
    }