/// <inheritdoc />
        /// <summary> Method used by a Progressor to when the current Value has changed </summary>
        /// <param name="progressor"> The Progressor that triggered this update </param>
        public override void UpdateTarget(Progressor progressor)
        {
            base.UpdateTarget(progressor);

            if (!m_initialized)
            {
                Init();
            }

            if (Text == null)
            {
                return;
            }

            m_targetValue = 0;
            switch (TargetVariable)
            {
            case TargetVariable.Value:
                m_targetValue = progressor.Value;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                if (WholeNumbers)
                {
                    m_targetValue = Mathf.Round(m_targetValue);
                }
                break;

            case TargetVariable.MinValue:
                m_targetValue = progressor.MinValue;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                break;

            case TargetVariable.MaxValue:
                m_targetValue = progressor.MaxValue;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                break;

            case TargetVariable.Progress:
                m_targetValue = progressor.Progress;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                if (WholeNumbers)
                {
                    m_targetValue = Mathf.Round(m_targetValue);
                }
                break;

            case TargetVariable.InverseProgress:
                m_targetValue = progressor.InverseProgress;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                if (WholeNumbers)
                {
                    m_targetValue = Mathf.Round(m_targetValue);
                }
                break;
            }


            Text.text = m_stringBuilder.Remove(0, m_stringBuilder.Length)
                        .Append(Prefix)
                        .Append(m_targetValue)
                        .Append(Suffix)
                        .ToString();
        }
示例#2
0
 /// <summary> Method used by a Progressor to when the current Value has changed </summary>
 /// <param name="progressor"> The Progressor that triggered this update.
 /// <para/> It allows access to all the relevant variables (Value, Progress, ReversedProgress, MinValue, MaxValue...)
 /// </param>
 public virtual void UpdateTarget(Progressor progressor)
 {
 }
        /// <inheritdoc />
        /// <summary> Method used by a Progressor to when the current Value has changed </summary>
        /// <param name="progressor"> The Progressor that triggered this update </param>
        public override void UpdateTarget(Progressor progressor)
        {
            base.UpdateTarget(progressor);

#if dUI_TextMeshPro
            if (TextMeshPro == null)
            {
                return;
            }

            m_targetValue = 0;
            switch (TargetVariable)
            {
            case TargetVariable.Value:
                m_targetValue = progressor.Value;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                if (WholeNumbers)
                {
                    m_targetValue = Mathf.Round(m_targetValue);
                }
                break;

            case TargetVariable.MinValue:
                m_targetValue = progressor.MinValue;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                break;

            case TargetVariable.MaxValue:
                m_targetValue = progressor.MaxValue;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                break;

            case TargetVariable.Progress:
                m_targetValue = progressor.Progress;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                if (WholeNumbers)
                {
                    m_targetValue = Mathf.Round(m_targetValue);
                }
                break;

            case TargetVariable.InverseProgress:
                m_targetValue = progressor.InverseProgress;
                if (UseMultiplier)
                {
                    m_targetValue *= Multiplier;
                }
                if (WholeNumbers)
                {
                    m_targetValue = Mathf.Round(m_targetValue);
                }
                break;
            }

            TextMeshPro.text = Prefix + m_targetValue + Suffix;
#endif
        }