public MusicTrack(MusicTrackType type, AudioClip clip, float volume = 1.0f, float pitch = 1.0f) { Type = type; Clip = clip; Volume = volume; Pitch = pitch; }
private List <MusicTrack> GetRandomizedTracks(List <MusicTrack> trackList, MusicTrackType type) { List <MusicTrack> list = new List <MusicTrack>(); List <MusicTrack> list2 = new List <MusicTrack>(); foreach (MusicTrack track in trackList) { if ((type == track.m_trackType) && !string.IsNullOrEmpty(track.m_name)) { if (track.m_shuffle) { list2.Add(track.Clone()); } else { list.Add(track.Clone()); } } } Random random = new Random(); while (list2.Count > 0) { int index = random.Next(0, list2.Count); list.Add(list2[index]); list2.RemoveAt(index); } return(list); }
public void PlayMusic(MusicTrackType type) { targetVolumes_[(int)type] = 1.0f; }
/// <summary> /// Initializes a new instance of the <see cref="MusicTrackInfo"/> class. /// </summary> /// <param name="trackIndex">Index of the track.</param> /// <param name="trackOffset">The track offset.</param> /// <param name="trackType">Type of the track.</param> public MusicTrackInfo(int trackIndex, int trackOffset, MusicTrackType trackType) { this.TrackIndex = trackIndex; this.TrackOffset = trackOffset; this.TrackType = trackType; }