Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
    public override void Tick()
    {
        base.Tick();

        if (lastAttack + damageCooldown <= Time.time)
        {
            Attackable attackable = target.GetComponent <Attackable>();
            attackable.Damage(damage);
            lastAttack = Time.time;
        }
    }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
	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;
	}
Ejemplo n.º 5
0
 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);
         }
     }
 }
Ejemplo n.º 6
0
 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);
             }
         }
     }
 }
Ejemplo n.º 7
0
 public override void OnContact(Attackable target)
 {
     target.Damage(damage);
 }