public static void InitMusic(SceneManager.SceneType sceneType) { if (Instance == null) { return; } Instance.InitListener(); Instance.InitAudioSource(sceneType); }
private void InitAudioSource(SceneManager.SceneType sceneType) { string path = string.Empty; if (sceneType == SceneManager.SceneType.Login) { path = "res/audio/login.audio"; } else if (sceneType == SceneManager.SceneType.Deploy) { path = "res/audio/battle.audio"; } if (string.IsNullOrEmpty(path)) { return; } Object res = AssetLoader.GetAsset(path); InitAudioClip(res); }