示例#1
0
    public async UniTask <bool> TryLoad(string path, AudioType audioType)
    {
        AudioClip clip = await clipController.LoadAudioClipWithWebRequest(path, audioType);

        for (int i = 0; i < audioSources.Count; i++)
        {
            audioSources[playIndex].clip = clip;
        }

        return(true);
    }
        public override async void Init(GameObject gameObject)
        {
            base.Init(gameObject);

            audioSource.loop   = false;
            audioSource.volume = 0.2f;

            clipController = new AudioClipController();
            await clipController.LoadAudioClipWithWebRequest(audioClipPath, AudioType.WAV);
        }
示例#3
0
    // Start is called before the first frame update
    async void Start()
    {
        AudioSource audioSource = gameObject.AddComponent <AudioSource>();

        AudioClipController controller = new AudioClipController();
        await controller.LoadAudioClipWithWebRequest(TEST_EFFECT_PATH, AudioType.WAV);

        controller.SetFadeOutCurve();

        audioSource.clip = controller.GetAudioClip();

        audioSource.Play();
    }
        public async void AdjustPitchForCutEffect()
        {
            return;

            Logger.log.Error("AdjustPitchForCutEffect");

            player.SetPitch(1f); //must initialize

            IDifficultyBeatmap        diffBeatmap = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap;
            CustomPreviewBeatmapLevel customPreviewBeatmapLevel = diffBeatmap.level as CustomPreviewBeatmapLevel;

            if (customPreviewBeatmapLevel != null)
            {
                string customLevelPath = customPreviewBeatmapLevel.customLevelPath;
                string songFileName    = customPreviewBeatmapLevel.standardLevelInfoSaveData.songFilename;
                string filepath        = customLevelPath + "\\" + songFileName;
                Logger.log.Error("custom level path = " + filepath);

                AudioClipController customSong = new AudioClipController();
                await customSong.LoadAudioClipWithWebRequest(filepath, AudioType.OGGVORBIS);
            }
        }