Exemple #1
0
        private void InitHpMp()
        {
            var initHp = (int)(this.baseProp.hpMax * this.baseInfo.hpPercent + 0.5f);

            this.hp = MathTools.Clamp(initHp, 1, hpMax);
            var initMp = (int)(this.baseProp.hpMax * this.baseInfo.hpPercent + 0.5f);

            this.mp = MathTools.Clamp(initMp, 1, mpMax);
        }
Exemple #2
0
 public void ChangeHp(int value)
 {
     if (!dead)
     {
         hp = MathTools.Clamp(hp + value, 0, hpMax);
         if (hp == 0)
         {
             this.dead = true;
         }
         battle.recorder.PushHpChange(this);
     }
 }
Exemple #3
0
 public void TestClampInt(int x, int min, int max, int expected)
 {
     Assert.AreEqual(expected, MathTools.Clamp(x, min, max));
 }