コード例 #1
0
ファイル: Hero.cs プロジェクト: duygu-rmdn/04.OOP
    public void Attack(IAttakable target)
    {
        this.weapon.Attack(target);

        if (target.IsDead())
        {
            this.experience += target.GiveExperience();
        }
    }
コード例 #2
0
ファイル: Axe.cs プロジェクト: duygu-rmdn/04.OOP
    public void Attack(IAttakable target)
    {
        if (this.durabilityPoints <= 0)
        {
            throw new InvalidOperationException("Axe is broken.");
        }

        target.TakeAttack(this.attackPoints);
        this.durabilityPoints -= 1;
    }
コード例 #3
0
 public void Attack(IAttakable target)
 {
 }