private void DoHit(Attackable target) { foreach (MissileEffect e in data.onHit) { switch (e.type) { case MissileEffectType.Buff: if (target is Character) { Character c = (Character)target; c.AddBuff(new BuffInstance() { buff = e.buffData, duration = e.buffDuration, origin = owner, target = c, canExpire = true }); } break; case MissileEffectType.Damage: target.Damage(e.damageAmount, e.damageType); break; case MissileEffectType.ParticleBurst: break; default: break; } } }
public override void Tick() { base.Tick(); if (lastAttack + damageCooldown <= Time.time) { Attackable attackable = target.GetComponent <Attackable>(); attackable.Damage(damage); lastAttack = Time.time; } }
IEnumerator Wait(Attackable a) { Attacking = true; ready = false; yield return new WaitForSeconds(timePerAttack / 2); AudioPlay. PlaySound(attackSound); if (a != null) a.Damage(this); Attacking = false; yield return new WaitForSeconds(timePerAttack / 2); ready = true; }
public virtual bool DoDamageToTarget(Attackable target) { if (CanAttack(target)) { float damageDone = target.Damage(Power, this); Experience += GameManager.Instance.CalculateDamageDoneExp(damageDone, RelativeStrength, target.RelativeStrength); if (target.IsDead) { Experience += GameManager.Instance.CalculateEnemyKilledExp(RelativeStrength, target.RelativeStrength); } return true; } return false; }
private void Damage(Collider[] colliders, Attackable origin, ICollection <Attackable> targets) { foreach (Collider collider in colliders) { Attackable attackable = collider.GetComponent <Attackable>(); if (attackable == null || attackable == origin) { continue; } Attackable attackableRoot = attackable.GetAttackableRoot(); if (!targets.Contains(attackableRoot) && attackable.CanDamage()) { attackable.Damage(damageAmount, damageType); targets.Add(attackableRoot); } } }
public void DoDamage(float damageRatio, ICollection <Attackable> targets) { for (int i = 0; i < weaponParts.Length; ++i) { foreach (Collider collider in GetCollidersInBoxCollider(weaponParts[i].collider)) { Attackable attackable = collider.GetComponent <Attackable>(); if (attackable == null || attackable == (Attackable)wielder) { continue; } attackable = attackable.GetAttackableRoot(); if (!targets.Contains(attackable) && attackable.CanDamage()) { targets.Add(attackable); attackable.Damage(damageRatio * weaponParts[i].damageAmount, weaponParts[i].damageType); } } } }
public override void OnContact(Attackable target) { target.Damage(damage); }