Esempio n. 1
0
        private void MeterSampleProvider_StreamVolume(object sender, StreamVolumeEventArgs e)
        {
            PeakValueLeft = Normalize(e.MaxSampleValues[0]);

            if (e.MaxSampleValues.Length > 1)
            {
                PeakValueRight = Normalize(e.MaxSampleValues[1]);
            }
            else
            {
                PeakValueRight = PeakValueLeft;
            }

            OnPeak?.Invoke(new PeakEventArgs {
                Left  = PeakValueLeft,
                Right = PeakValueRight
            });
        }
Esempio n. 2
0
        private void Update()
        {
            curStageTime += Time.deltaTime;

            if (stage == 0)
            {
                curRadius = Mathf.Lerp(0f, Radius, curStageTime / timeExpansion);
                if (curRadius >= Radius)
                {
                    stage++;
                    curStageTime = 0;

                    OnPeak.Execute(this);
                }
            }

            if (stage == 1)
            {
                if (curStageTime >= timeStay)
                {
                    stage++;
                    curStageTime = 0;
                }
            }

            if (stage == 2)
            {
                curRadius = Mathf.Lerp(Radius, 0f, curStageTime / timeExpansion);
                if (curRadius <= 0f)
                {
                    stage++;
                    curStageTime = 0;

                    OnEnd.Execute(this);
                }
            }

            if (stage == 3)
            {
                Destroy(gameObject);
            }

            transform.localScale = new Vector3(curRadius, curRadius, curRadius);
        }