protected bool CalculateStrainValues() { // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. List <DifficultyHitObjectTaiko> .Enumerator HitObjectsEnumerator = DifficultyHitObjects.GetEnumerator(); if (HitObjectsEnumerator.MoveNext() == false) { return(false); } DifficultyHitObjectTaiko CurrentHitObject = HitObjectsEnumerator.Current; DifficultyHitObjectTaiko NextHitObject; // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject. while (HitObjectsEnumerator.MoveNext()) { NextHitObject = HitObjectsEnumerator.Current; NextHitObject.CalculateStrains(CurrentHitObject, TimeRate); CurrentHitObject = NextHitObject; } return(true); }
// Exceptions would be nicer to handle errors, but for this small project it shall be ignored. private bool CalculateStrainValues() { // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. List <tpHitObject> .Enumerator HitObjectsEnumerator = tpHitObjects.GetEnumerator(); if (HitObjectsEnumerator.MoveNext() == false) { Reports.Add(new AiReport(Severity.Info, "Can not compute difficulty of empty beatmap.")); return(false); } tpHitObject CurrentHitObject = HitObjectsEnumerator.Current; tpHitObject NextHitObject; // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See tpHitObject. while (HitObjectsEnumerator.MoveNext()) { NextHitObject = HitObjectsEnumerator.Current; NextHitObject.CalculateStrains(CurrentHitObject); CurrentHitObject = NextHitObject; } return(true); }