Example #1
0
        private void RefreshTotal()
        {
            Value = 0;
            if (inPoints.Count > 0 && inPoints[0].HasConnected)
            {
                Value = DigitConvert.CastTo(inPoints[0].Value, ValueType);
            }
            else
            {
                Value = DigitConvert.CastTo(inValues[0], ValueType);
            }

            for (int i = 1; i < inPoints.Count; i++)
            {
                var point = inPoints[i];
                if (point.HasConnected)
                {
                    if (point.Value.CastToFloat() == 0)
                    {
                        Debug.LogError("Divide number must be not equal to zero.");
                        continue;
                    }
                    Value = DigitConvert.Divide(Value, point.Value, ValueType);
                }
                else
                {
                    if (inValues[i].CastToFloat() == 0)
                    {
                        inValues[i] = 1f;
                    }
                    Value = DigitConvert.Divide(Value, inValues[i], ValueType);
                }
            }
        }
Example #2
0
        private void RefreshTotal()
        {
            Value = 0;
            if (inPoints.Count > 0 && inPoints[0].HasConnected)
            {
                Value = DigitConvert.CastTo(inPoints[0].Value, ValueType);
            }
            else
            {
                Value = DigitConvert.CastTo(inValues[0], ValueType);
            }

            for (int i = 1; i < inPoints.Count; i++)
            {
                var point = inPoints[i];
                if (point.HasConnected)
                {
                    Value = DigitConvert.Multi(Value, point.Value, ValueType);
                }
                else
                {
                    Value = DigitConvert.Multi(Value, inValues[i], ValueType);
                }
            }
        }