public static void Init() { GameObject obj = new GameObject("[AudioManager]"); AudioPlayManager audioManager = obj.AddComponent <AudioPlayManager>(); DontDestroyOnLoad(obj); a2DPlayer = new Audio2DPlayer(audioManager); a3DPlayer = new Audio3DPlayer(audioManager); TotleVolume = RecordManager.GetFloatRecord("GameSettingData", "TotleVolume", 1f); MusicVolume = RecordManager.GetFloatRecord("GameSettingData", "MusicVolume", 1f); SFXVolume = RecordManager.GetFloatRecord("GameSettingData", "SFXVolume", 1f); }
static int set_a2DPlayer(IntPtr L) { try { Audio2DPlayer arg0 = (Audio2DPlayer)ToLua.CheckObject(L, 2, typeof(Audio2DPlayer)); AudioPlayManager.a2DPlayer = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private static void Init() { GameObject obj = new GameObject("[AudioManager]"); AudioPlayManager audioManager = obj.AddComponent <AudioPlayManager>(); DontDestroyOnLoad(obj); a2DPlayer = new Audio2DPlayer(audioManager); a3DPlayer = new Audio3DPlayer(audioManager); TotleVolume = 1; MusicVolume = 1; SFXVolume = 1; }
///// <summary> ///// 2D 音乐转态转换 回调(参数 :资源名,channel,切换的转态,flag(标识:用于在多个相同音频名称时分辨)) ///// </summary> //public static CallBack<string, int, AudioPlayState, string> audio2DMusicStateCallBack; ///// <summary> ///// 2D 音乐转态转换 回调(参数 :资源名,切换的转态,flag(标识:用于在多个相同音频名称时分辨)) ///// </summary> //public static CallBack<string, AudioPlayState, string> audio2DSFXStateCallBack; #endregion public static void Init() { GameObject obj = new GameObject("[AudioManager]"); AudioPlayManager audioManager = obj.AddComponent <AudioPlayManager>(); DontDestroyOnLoad(obj); obj.AddComponent <AudioListener> (); a2DPlayer = new Audio2DPlayer(audioManager); a3DPlayer = new Audio3DPlayer(audioManager); MasterVolume = GameSetting.MasterVolume; MusicVolume = GameSetting.MusicVolume; SFXVolume = GameSetting.SFXVolume; }
private void Awake() { Audio2DPlayer audio2DPlayer = FindObjectsOfType <Audio2DPlayer>()[0]; GetComponent <Button>().onClick.AddListener(() => audio2DPlayer.PlayOneShot()); }