protected override double StrainValueOf(DifficultyHitObject current) { // changing from/to a drum roll or a swell does not constitute a colour change. // hits spaced more than a second apart are also exempt from colour strain. if (!(current.LastObject is Hit && current.BaseObject is Hit && current.DeltaTime < 1000)) { monoHistory.Clear(); var currentHit = current.BaseObject as Hit; currentMonoLength = currentHit != null ? 1 : 0; previousHitType = currentHit?.Type; return(0.0); } var taikoCurrent = (TaikoDifficultyHitObject)current; double objectStrain = 0.0; if (previousHitType != null && taikoCurrent.HitType != previousHitType) { // The colour has changed. objectStrain = 1.0; if (monoHistory.Count < 2) { // There needs to be at least two streaks to determine a strain. objectStrain = 0.0; } else if ((monoHistory[^ 1] + currentMonoLength) % 2 == 0)
public void TestClearQueue() { queue.Enqueue(3); queue.Enqueue(5); Assert.AreEqual(2, queue.Count); queue.Clear(); Assert.AreEqual(0, queue.Count); Assert.Throws <ArgumentOutOfRangeException>(() => _ = queue[0]); queue.Enqueue(7); Assert.AreEqual(1, queue.Count); Assert.AreEqual(7, queue[0]); Assert.Throws <ArgumentOutOfRangeException>(() => _ = queue[1]); queue.Enqueue(9); Assert.AreEqual(2, queue.Count); Assert.AreEqual(9, queue[1]); }