Esempio n. 1
0
        public void Should_format_float_statistics(float value, string expected)
        {
            var statistic = new FloatStatistic(() => value);

            statistic.Refresh();
            Assert.AreEqual(expected, statistic.Formatted);
        }
Esempio n. 2
0
    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());
        }
    }
Esempio n. 3
0
    /*
     * //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;
    }
Esempio n. 4
0
 public float Get(FloatStatistic id)
 {
     return(floatCalculators.ContainsKey(id)
         ? floatCalculators[id]()
         : floatStatistics[id]);
 }
Esempio n. 5
0
 public void Remove(FloatStatistic id, float value)
 {
     floatStatistics[id] -= value;
 }
Esempio n. 6
0
 internal void AddCalculator(FloatStatistic id, Func <float> calculator)
 {
     floatCalculators[id] = calculator;
 }
Esempio n. 7
0
 public FloatStatisticCommand(FloatStatistic id, float value)
 {
     this.id    = id;
     this.value = value;
 }