示例#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);
        }
示例#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);
     }
 }
示例#3
0
 public void TestClampInt(int x, int min, int max, int expected)
 {
     Assert.AreEqual(expected, MathTools.Clamp(x, min, max));
 }