/// <summary> /// Resets some or all properties of this score. /// </summary> /// <param name="flags"></param> public void Reset(ScoreResetFlags flags) { //if skip persistent flag is set, we skip resetting any value if ((0 != (flags & ScoreResetFlags.SkipPersistent)) && persist) { return; } //check if score should be reset if (0 != (flags & ScoreResetFlags.Score)) { // Note: the below code is a bug since it will set Prev to 0 and // then set Curr to 0. Since Curr is an accessor it first sets // Prev to Curr's current value before setting curr to 0. // Side-effects... //Curr = Prev = 0; Curr = 0; Prev = 0; } //check if Active flag should be reset if (0 != (flags & ScoreResetFlags.Active)) { Active = false; } //check if Visibility should be reset if (0 != (flags & ScoreResetFlags.Visibility)) { Visibility = kDefaultVisibility; } }
} // end of c'tor /// <summary> /// Resets some or all properties on all scores. /// </summary> /// <param name="flags"></param> public void Reset(ScoreResetFlags flags) { foreach (Score score in scores.Values) { score.Reset(flags); } } // end of Reset()
/// <summary> /// Resets some or all properties of the score corresponding to the given bucket. /// </summary> /// <param name="bucket"></param> /// <param name="flags"></param> public static void ResetScore(ScoreBucket bucket, ScoreResetFlags flags) { if (bucket == ScoreBucket.NotApplicable) { Reset(flags); } else if (scores.ContainsKey((int)bucket)) { scores[(int)bucket].Reset(flags); } }
/// <summary> /// Resets some or all properties on all scores. /// </summary> /// <param name="flags"></param> public static void Reset(ScoreResetFlags flags) { ScoreMap.ValueCollection.Enumerator it = scores.Values.GetEnumerator(); while (it.MoveNext()) { it.Current.Reset(flags); } ReleaseScoreEffects(); }