/// <summary> /// Tries to lock a beat in. Checks if each of the points (i.e. m_HighPoints) variables have passed /// the threshold (m_PointsLimit). If the passed beat is of that type then we can lock it in. /// </summary> /// <param name="BeatToLockIn">The beat object candidate</param> private void TryToLockInBeat(Beat BeatToLockIn) { if (BeatToLockIn.GetMood() == Moods.High && m_HighPoints >= m_PointsLimit) { m_NextTrack = BeatToLockIn; m_NextTrackLocked = true; ResetPoints(); } else if (BeatToLockIn.GetMood() == Moods.Mid && m_MidPoints >= m_PointsLimit) { m_NextTrack = BeatToLockIn; m_NextTrackLocked = true; ResetPoints(); } else if (BeatToLockIn.GetMood() == Moods.Low && m_LowPoints >= m_PointsLimit) { m_NextTrack = BeatToLockIn; m_NextTrackLocked = true; ResetPoints(); } else { //Default case, use whatever has been passed but allow other tracks to become locked in in the meantime m_NextTrack = BeatToLockIn; } }
/// <summary> /// Attempts to add a track to be played. /// If a track has already been locked in then the passed parameter is ignored /// Otherwise it records the number of /// </summary> /// <param name="BeatToPlay"></param> public void TryPlayBeat(Beat BeatToPlay) { //If a track is locked, it is garunteed to play. All other readings are ignored if (!m_NextTrackLocked) { SetPoints(BeatToPlay.GetMood()); TryToLockInBeat(BeatToPlay); } }