/// <summary> /// On enable we start listening for events /// </summary> protected virtual void OnEnable() { MMSfxEvent.Register(OnMMSfxEvent); this.MMEventStartListening <TopDownEngineEvent>(); this.MMEventStartListening <MMGameEvent>(); LoadSoundSettings(); _loopingSounds = new List <AudioSource>(); }
/// <summary> /// On disable we stop listening for events /// </summary> protected virtual void OnDisable() { if (_enabled) { MMSfxEvent.Unregister(OnMMSfxEvent); this.MMEventStopListening <TopDownEngineEvent>(); this.MMEventStopListening <MMGameEvent>(); } }
/// <summary> /// On enable we start listening for events /// </summary> protected virtual void OnEnable() { MMSfxEvent.Register(OnMMSfxEvent); this.MMEventStartListening <MMGameEvent>(); this.MMEventStartListening <CorgiEngineEvent>(); LoadSoundSettings(); _loopingSounds = new List <AudioSource> (); SceneManager.sceneLoaded += OnSceneLoaded; }
/// <summary> /// On disable we stop listening for events /// </summary> protected virtual void OnDisable() { if (_enabled) { MMSfxEvent.Unregister(OnMMSfxEvent); this.MMEventStopListening <MMGameEvent>(); this.MMEventStopListening <CorgiEngineEvent>(); SceneManager.sceneLoaded -= OnSceneLoaded; } }
/// <summary> /// When we grab a sfx event, we play the corresponding sound /// </summary> /// <param name="sfxEvent"></param> public virtual void OnMMEvent(MMSfxEvent sfxEvent) { PlaySound(sfxEvent.ClipToPlay, this.transform.position); }