Exemplo n.º 1
0
        public void Should_format_int_statistics(int value, string expected)
        {
            var statistic = new IntStatistic(() => value);

            statistic.Refresh();
            Assert.AreEqual(expected, statistic.Formatted);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Increase the value of the specified integer statistic by the specified amount.
 /// </summary>
 public void Increment(IntStatistic stat, int amount = 1)
 {
     if (!m_intStats.ContainsKey(stat))
     {
         m_intStats[stat] = amount;
     }
     else
     {
         m_intStats[stat] += amount;
     }
 }
Exemplo n.º 3
0
    public void TakeDamage(float damage)
    {
        damage -= Armor;
        damage  = Mathf.Clamp(damage, 0, Int32.MaxValue);

        CurrentHealth -= damage;

        if (CurrentHealth <= 0)
        {
            Die();
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// Get the value of the supplied statistic.
 /// </summary>
 public int Get(IntStatistic stat)
 {
     return(m_intStats.ContainsKey(stat) ? m_intStats[stat] : 0);
 }