Exemple #1
0
    protected override void ActivateTrapComponent(GameObject enemy)
    {
        Damagable damagable = enemy.GetComponent <Damagable>();

        if (damagable != null)
        {
            damagable.DealDamage(effectValue[0]);
        }
    }
Exemple #2
0
    private void OnCollisionEnter(Collision collision)
    {
        Damagable damagable = collision.gameObject.GetComponent <Damagable>();

        if (damagable != null)
        {
            damagable.DealDamage(bulletDamage);
        }
        Invoke("DetroyBullet", DestroyBulletAfterCollisionTime);
    }
Exemple #3
0
    private void DealDamage(Collider col)
    {
        Damagable damagable = col.GetComponentInChildren <Damagable>();

        if (damagable != null && damagable.team != team)
        {
            damagable.DealDamage(damageAmount);
            onDamageDealt.Invoke();
        }
    }
 private void DealDamage(GameObject toDealDamage)
 {
     if (Time.timeSinceLevelLoad > lastTimeHit + actualUnitStatistic.MinTimeBetweenAttacks)
     {
         Damagable damagable = toDealDamage.GetComponent <Damagable>();
         if (damagable != null)
         {
             damagable.DealDamage(actualUnitStatistic.Damage);
             lastTimeHit = Time.timeSinceLevelLoad;
         }
     }
 }
Exemple #5
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Damagable damagable = collision.GetComponent <Damagable>();

        if (damagable != null)
        {
            bool healed = damagable.DealDamage(-healPoints);
            if (healed)
            {
                Destroy(gameObject);
            }
        }
    }
Exemple #6
0
    private void OnTriggerEnter(Collider other)
    {
        Damagable damagable = other.gameObject.GetComponentInParent <Damagable>();

        if (damagable == null)
        {
            damagable = other.gameObject.GetComponent <Damagable>();
        }
        if (damagable != null)
        {
            damagable.DealDamage(gameObject, damage);
        }
        print(other.gameObject.name);
    }