コード例 #1
0
        protected override void Update()
        {
            base.Update();

            UpdateSize();

            if (!IsValid())
            {
                return;
            }

            if (textureBar != _textureBar) // texture bar dirty?
            {
                textureBarVisibleBoundsOrig = FindBounds(textureBar);
                if (textureBarVisibleBoundsOrig.width == 0) // not readable (yet)
                {
                    return;
                }

                textureBarVisibleBounds = textureBarVisibleBoundsOrig;
                _textureBar             = textureBar;
            }

//        FixRatio();

            // update blink effect
            if (effectBlink)
            {
                effectBlinkVisible = EnergyBarCommons.Blink(
                    energyBar.ValueF, effectBlinkValue, effectBlinkRatePerSecond, ref effectBlinkAccum);
            }
        }
コード例 #2
0
 private void UpdateBlinkEffect() {
     if (forceBlinking) {
         Blink = EnergyBarCommons.Blink(effectBlinkRatePerSecond, ref _effectBlinkAccum);
     } else if (CanBlink()) {
         Blink = EnergyBarCommons.Blink(effectBlinkRatePerSecond, ref _effectBlinkAccum);
     } else {
         Blink = false;
     }
 }
コード例 #3
0
    protected override void Update() {
        if (RebuildNeeded()) {
            Rebuild();
        }

        base.Update();

        if (effectBlink) {
            Blink = EnergyBarCommons.Blink(
                ValueF, effectBlinkValue, effectBlinkRatePerSecond, ref _effectBlinkAccum);
        } else {
            Blink = false;
        }

        UpdateBar();
        UpdatePivot();
        UpdateFollowEffect();
    }
コード例 #4
0
        void Update()
        {
            UpdateSize();

            if (!IsValid())
            {
                return;
            }

            if (textureBar != _textureBar) // texture bar dirty?
            {
                textureBarVisibleBoundsOrig = FindBounds(textureBar);
                if (textureBarVisibleBoundsOrig.width == 0) // not readable (yet)
                {
                    return;
                }

                textureBarVisibleBounds = textureBarVisibleBoundsOrig;
                _textureBar             = textureBar;
            }

//        FixRatio();

            if (effectBurn)
            {
                if (effectSmoothChange)
                {
                    // in burn mode smooth primary bar only when it's increasing
                    if (energyBar.ValueF > actualDisplayValue)
                    {
                        EnergyBarCommons.SmoothDisplayValue(ref actualDisplayValue, energyBar.ValueF, effectSmoothChangeSpeed);
                    }
                    else
                    {
                        actualDisplayValue = energyBar.ValueF;
                    }
                }
                else
                {
                    actualDisplayValue = energyBar.ValueF;
                }

                EnergyBarCommons.SmoothDisplayValue(ref burnDisplayValue, actualDisplayValue, effectSmoothChangeSpeed);
                burnDisplayValue = Mathf.Max(burnDisplayValue, actualDisplayValue);
            }
            else
            {
                if (effectSmoothChange)
                {
                    EnergyBarCommons.SmoothDisplayValue(ref actualDisplayValue, energyBar.ValueF, effectSmoothChangeSpeed);
                }
                else
                {
                    actualDisplayValue = energyBar.ValueF;
                }

                burnDisplayValue = actualDisplayValue;
            }

            // update blink effect
            if (effectBlink)
            {
                effectBlinkVisible = EnergyBarCommons.Blink(
                    energyBar.ValueF, effectBlinkValue, effectBlinkRatePerSecond, ref effectBlinkAccum);
            }
        }