public void IsFullAfterNegativeAndGreaterPositiveChange(int maxHealth, int negativeChange, int greaterPositiveChange)
        {
            WormyHealth wormyHealth = new WormyHealth(maxHealth);

            wormyHealth.ChangeHealth(negativeChange);
            wormyHealth.ChangeHealth(greaterPositiveChange);
            Assert.AreEqual(maxHealth, wormyHealth.Health);
        }
        public void IsIncreasedAfterNegativeAndLesserPositiveChange(int maxHealth, int negativeChange, int lesserPositiveChange)
        {
            WormyHealth wormyHealth = new WormyHealth(maxHealth);

            wormyHealth.ChangeHealth(negativeChange);
            wormyHealth.ChangeHealth(lesserPositiveChange);
            Assert.AreEqual(maxHealth + negativeChange + lesserPositiveChange, wormyHealth.Health);
        }
示例#3
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.relativeVelocity.magnitude > maxRelativeVelocity)
     {
         wormyHealth.ChangeHealth(-3);
         if (IsTurn)
         {
             WormyManager.singleton.NextWorm();
         }
     }
 }
        public void RemainsFullAfterPositiveChange(int maxHealth, int positiveChange)
        {
            WormyHealth wormyHealth = new WormyHealth(maxHealth);

            wormyHealth.ChangeHealth(positiveChange);
            Assert.AreEqual(maxHealth, wormyHealth.Health);
        }
        public void IsZeroAfterGreaterNegativeChange(int maxHealth, int negativeChange)
        {
            WormyHealth wormyHealth = new WormyHealth(maxHealth);

            wormyHealth.ChangeHealth(negativeChange);
            Assert.AreEqual(0, wormyHealth.Health);
        }
        public void IsDecreasedAfterNegativeChange(int maxHealth, int negativeChange)
        {
            WormyHealth wormyHealth = new WormyHealth(maxHealth);

            wormyHealth.ChangeHealth(negativeChange);
            Assert.AreEqual(maxHealth + negativeChange, wormyHealth.Health);
        }