Example #1
0
        private void UpdateSpectrum(object sender, EventArgs e)
        {
            if (Settings.SamplingRate > 0)
            {
                if (++timerTicks * dispatcherTimer.Interval.Milliseconds >= 1000 / Settings.SamplingRate)
                {
                    SpectrumProcessorBase.Sample(Settings);
                    timerTicks = 0;
                }
            }

            var spectrum = SpectrumProcessorBase.GetSmoothSpectrum(Settings);
            var color    = ColorMixer.GetColor(Settings, spectrum).ToWMColor();
            var data     = new VisualizationData(spectrum, color);

            // Update devices.
            foreach (var device in VisualDevices)
            {
                device.Send(data);
            }

            // Update UI.
            VisualizationDrawer.Send(data);
            Background = new SolidColorBrush(color);
        }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        float hpRatio = (float)unit.HP / unit.maxHP;

        transform.LookAt(cameraMain.transform);
        transform.localScale = new Vector3(hpRatio, 1, 1);
        bar.material.color   = colorMix.GetColor(hpRatio);
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        float hpRatio = (float)unit.HP / unit.maxHP;

        hpRatio        = Mathf.Clamp01(hpRatio);
        bar.offsetMax  = new Vector2(hpRatio * initialOffset, bar.offsetMax.y);
        bar.offsetMin  = new Vector2(-hpRatio * initialOffset, bar.offsetMin.y);
        barImage.color = colorGradient.GetColor(hpRatio);
        hpText.text    = Mathf.Max(unit.HP, 0) + "/" + unit.maxHP;
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        float hpRatio = (float)unit.HP / unit.maxHP;

        hpRatio = Mathf.Clamp01(hpRatio);
        if (autoRotate)
        {
            bar.LookAt(cameraMain.transform);
        }
        bar.localScale             = new Vector3(hpRatio, 1, 1);
        barRenderer.material.color = colorGradient.GetColor(hpRatio);
    }