public void Should_format_float_statistics(float value, string expected) { var statistic = new FloatStatistic(() => value); statistic.Refresh(); Assert.AreEqual(expected, statistic.Formatted); }
public static string Translate(this FloatStatistic statistic) { switch (statistic) { case FloatStatistic.Jumps: return("avatar.numberOfJumps"); case FloatStatistic.TimePassed: return("Time.alive"); case FloatStatistic.CurrentX: return("transform.position.x"); case FloatStatistic.CurrentY: return("transform.position.y"); case FloatStatistic.CurrentSpeed: return("rigidbody.velocity.magnitude"); case FloatStatistic.GroundedTime: return("Time.grounded"); case FloatStatistic.AirborneTime: return("Time.airborne"); case FloatStatistic.RollingTime: return("Time.rolling"); case FloatStatistic.DeadTime: return("Time.dead"); case FloatStatistic.Rolls: return("avatar.numberOfRolls"); case FloatStatistic.MaximumSpeed: return("Math.Max(rigidbody.velocity.magnitude)"); default: return(statistic.ToString()); } }
/* * //IntPair are singular integer values * public void Add(IntStatistic id, int value) { * intStatistics[id] += value; * } * public void Remove(IntStatistic id, int value) { * intStatistics[id] -= value; * } * public int Get(IntStatistic id) { * return intStatistics[id]; * } * //*/ //FloatPair are singular floating-point values public void Add(FloatStatistic id, float value) { floatStatistics[id] += value; }
public float Get(FloatStatistic id) { return(floatCalculators.ContainsKey(id) ? floatCalculators[id]() : floatStatistics[id]); }
public void Remove(FloatStatistic id, float value) { floatStatistics[id] -= value; }
internal void AddCalculator(FloatStatistic id, Func <float> calculator) { floatCalculators[id] = calculator; }
public FloatStatisticCommand(FloatStatistic id, float value) { this.id = id; this.value = value; }