/// <summary> /// The ContextInterface() in a Strategy Pattern. /// </summary> public void Attack(ICharacterClass target) { Console.WriteLine(this.className + " attacks " + target.className + "!"); int damage = myAtackBehavior.Attack(this); target.Defend(damage); }
/// <summary> /// Попытаться атаковать другой играбельный юнит. /// </summary> /// <param name="other"></param> public void Attack(PlayableUnit other) { if (!CanAtack(other)) { return; } attackBehavior.Attack(this, other); }
public virtual void Attack(Character character) { attackBehavior.Attack(this, character); }
public void Attack() { attackBehavior.Attack(); }
//Performs the attack behavior. Virtual means this method can be overridden by a subclass. public virtual void DoAttack() { AttackBehavior.Attack(); }