コード例 #1
0
 public void TryAttack()
 {
     if (m_TakeObjectController.IsTaken)
     {
         m_TakeObjectController.Throw();
     }
     else
     {
         m_Damager.Attack();
     }
 }
コード例 #2
0
        public static void TakingDamage()
        {
            var damageable = new Damageable(health: 100);
            var damager    = new Damager(attackDamage: 10);

            int healthBefore = damageable.Health;

            damager.Attack(damageable);
            int healthAfter = damageable.Health;

            Assert.AreEqual(healthBefore - damager.AttackDamage, healthAfter);
        }