Ejemplo n.º 1
0
 protected virtual void ReceiveDamage(DamageInfo info)
 {
     if (!this.invincible)
     {
         this.health.Subtract(Mathf.Max(0, info.Amount - this.defense.Value));
         if (!Dead)
             StartCoroutine(_TickInvincibility(this.invincibiltyTime));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Performs an attack action.
        /// </summary>
        /// <param name="damageType">Type of damage that will be applied.</param>
        /// <param name="extraDamage">Value to be added to the base damage before applying it to the targets.</param>
        /// <param name="targets">One or more entities that will have damage applied to them.</param>
        public void Execute(DamageInfo.DamageType damageType, float extraDamage, params IInteractable[] targets)
        {
            if(targets == null || targets.Length < 1)
                throw new ArgumentException("Cannot execute the attack logic without a target.");

            float totalDamage = (damage ? damage.Value : 0) + extraDamage;

            dmgInfo = new DamageInfo(damageType, totalDamage, agent);
            foreach (Entity target in targets)
                target.Interact(this);
        }
Ejemplo n.º 3
0
 public void Execute(DamageInfo.DamageType damageType, params IInteractable[] targets)
 {
     Execute(damageType, 0, targets);
 }