public void Init() { autoListener = new GameObject("GameFramework.MusicModule"); Object.DontDestroyOnLoad(autoListener); autoListener.AddComponent <AudioListener>(); audios = new List <AudioSource>(); GameObject _bgm = new GameObject("bgm"); UtilityUnity.SetParent(_bgm, autoListener); bgm = _bgm.AddComponent <AudioSource>(); bgm.loop = true; Refresh(); }
public void PlayAudio(AudioClip _audio) { AudioSource _as = null; GameObject _new = PoolModule.instance.Pop <GameObject>("AUDIO_PLAYER"); if (_new == null) { _new = new GameObject(_audio.name); _as = _new.AddComponent <AudioSource>(); } else { _new.SetActive(true); _as = _new.GetComponent <AudioSource>(); } UtilityUnity.SetParent(_new, autoListener); _as.clip = _audio; _as.mute = !PersistenceData.GetPrefsDataBool(CommonKey.SWITCH_AUDIO, true); _as.Play(); Refresh(); audios.Add(_as); }
public void OnEndDrag(PointerEventData eventData) { UtilityUnity.SetParent(gameObject, lastFather); MessageModule.instance.Recevive(eventKeyName, MessageType.EventEndDrag, gameObject); }
public void OnBeginDrag(PointerEventData eventData) { MessageModule.instance.Recevive(eventKeyName, MessageType.EventBeginDrag, gameObject); lastFather = parent.gameObject; UtilityUnity.SetParent(gameObject, tempFather); }