コード例 #1
0
 /// <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>();
 }
コード例 #2
0
 /// <summary>
 /// On disable we stop listening for events
 /// </summary>
 protected virtual void OnDisable()
 {
     if (_enabled)
     {
         MMSfxEvent.Unregister(OnMMSfxEvent);
         this.MMEventStopListening <TopDownEngineEvent>();
         this.MMEventStopListening <MMGameEvent>();
     }
 }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
        /// <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;
            }
        }
コード例 #5
0
 /// <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);
 }