コード例 #1
0
ファイル: ProjectService.cs プロジェクト: dqchess/Linyx
        private void ScaleReact(ILineModel line)
        {
            if (!line.ScaleProperty.IsScaleReactOnAudio)
            {
                return;
            }
            float value;

            switch (line.EmissionProperty.EmissionFrequencyType)
            {
            case AudioFrequencyType.Band:
                value = AudioPeerService.GetAudioBand(line.ScaleProperty.ScaleBandBuffer);
                break;

            case AudioFrequencyType.BandBuffer:
                value = AudioPeerService.GetAudioBandBuffer(line.ScaleProperty.ScaleBandBuffer);
                break;

            case AudioFrequencyType.Amplitude:
                value = AudioPeerService.GetAmplitude();
                break;

            case AudioFrequencyType.AmplitudeBuffer:
                value = AudioPeerService.GetAmplitudeBuffer();
                break;

            case AudioFrequencyType.Frequency:
                value = AudioPeerService.GetFrequencyBand(line.ScaleProperty.ScaleBandBuffer);
                break;

            case AudioFrequencyType.FrequencyBuffer:
                value = AudioPeerService.GetFrequencyBandBuffer(line.ScaleProperty.ScaleBandBuffer);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (value > line.ScaleProperty.ScaleThreshold)
            {
                line.LineGameObject.widthMultiplier = value * line.ScaleProperty.ScaleMultiplier;
            }
            else
            {
                line.LineGameObject.widthMultiplier = 1;
            }
        }
コード例 #2
0
ファイル: ProjectService.cs プロジェクト: dqchess/Linyx
        private void EmissionReact(ILineModel line)
        {
            if (!line.EmissionProperty.IsEmissionReactOnAudio || !line.IsEmissionEnabled)
            {
                return;
            }
            float value;

            switch (line.EmissionProperty.EmissionFrequencyType)
            {
            case AudioFrequencyType.Band:
                value = AudioPeerService.GetAudioBand(line.EmissionProperty.EmissionBandBuffer);
                break;

            case AudioFrequencyType.BandBuffer:
                value = AudioPeerService.GetAudioBandBuffer(line.EmissionProperty.EmissionBandBuffer);
                break;

            case AudioFrequencyType.Amplitude:
                value = AudioPeerService.GetAmplitude();
                break;

            case AudioFrequencyType.AmplitudeBuffer:
                value = AudioPeerService.GetAmplitudeBuffer();
                break;

            case AudioFrequencyType.Frequency:
                value = AudioPeerService.GetFrequencyBand(line.EmissionProperty.EmissionBandBuffer);
                break;

            case AudioFrequencyType.FrequencyBuffer:
                value = AudioPeerService.GetFrequencyBandBuffer(line.EmissionProperty.EmissionBandBuffer);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            if (value > line.EmissionProperty.EmissionThreshold)
            {
                line.LineGameObject.sharedMaterial.SetColor("_EmissionColor", line.EmissionIntensity * line.EmissionColor * value);
            }
            else
            {
                line.LineGameObject.sharedMaterial.SetColor("_EmissionColor", Color.black);
            }
        }