Пример #1
0
        /// <summary>
        /// 更新音频数据
        /// </summary>
        /// <param name="audioDataType">音频分布类型</param>
        private static void UpdateAudioData(AudioDataDistributionType audioDataType)
        {
            ScenesDatas scenesDatas = ModelManager.Instance.GetScenesDatas;

            float[] samples = new float[scenesDatas.AudioDatas.Length];
            Tools.AudioSourceData.GetCurrentSongData(scenesDatas.AudioSource, samples);
            Transform[] audioDatas = scenesDatas.AudioDatas;
            Parameter   parameter  = ModelManager.Instance.GetParameter;

            switch (audioDataType)
            {
            case AudioDataDistributionType.Asymmetric:
                AudioVisualizer.OnAsymmetric(audioDatas, samples, parameter);
                break;

            case AudioDataDistributionType.Symmetry:
                AudioVisualizer.OnSymmetry(audioDatas, samples, parameter);
                break;

            case AudioDataDistributionType.DoubleSymmetry:
                AudioVisualizer.OnDoubleSymmetry(audioDatas, samples, parameter);
                break;

            default:
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// 心跳刷新
        /// </summary>
        /// <param name="data">数据</param>
        internal static void RefreshHeartbeat()
        {
            LogicDatas logicDatas = ModelManager.Instance.GetLogicDatas;

            logicDatas.Timer += Time.deltaTime;
            if (logicDatas.Timer > ModelManager.Instance.GetParameter.UpdateInterval)
            {
                logicDatas.Timer = 0;
                AudioVisualizer.Surround(ModelManager.Instance.GetScenesDatas.AudioDatas, ModelManager.Instance.GetParameter);
                if (logicDatas.GameState != GameState.Playing)
                {
                    return;
                }
                AudioVisualizer.UpdateAudioData(AudioDataDistributionType.DoubleSymmetry);
            }
        }