/// <summary> /// On disable, stops listening for playlist events /// </summary> protected virtual void OnDisable() { MMPlaylistPauseEvent.Unregister(OnPauseEvent); MMPlaylistPlayEvent.Unregister(OnPlayEvent); MMPlaylistPlayNextEvent.Unregister(OnPlayNextEvent); MMPlaylistStopEvent.Unregister(OnStopEvent); MMPlaylistPlayIndexEvent.Unregister(OnPlayIndexEvent); }
/// <summary> /// On enable, starts listening for playlist events /// </summary> protected virtual void OnEnable() { MMPlaylistPauseEvent.Register(OnPauseEvent); MMPlaylistPlayEvent.Register(OnPlayEvent); MMPlaylistPlayNextEvent.Register(OnPlayNextEvent); MMPlaylistPlayPreviousEvent.Register(OnPlayPreviousEvent); MMPlaylistStopEvent.Register(OnStopEvent); MMPlaylistPlayIndexEvent.Register(OnPlayIndexEvent); }
/// <summary> /// Plays the track set in parameters /// </summary> public virtual void PlayTrack(int trackIndex) { MMPlaylistPlayIndexEvent.Trigger(trackIndex); }
/// <summary> /// Plays the track selected in the inspector /// </summary> public virtual void PlaySelectedTrack() { MMPlaylistPlayIndexEvent.Trigger(TrackNumber); }