Ejemplo n.º 1
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         var enemyHealth = collision.gameObject.GetComponent <Enemy>().enemyHealth;
         if (bulletDamage > enemyHealth)
         {
             bulletDamage = bulletDamage - enemyHealth;
         }
         else
         {
             if (!isPenetrated)
             {
                 bulletDamage = Mathf.RoundToInt(bulletDamage * bulletPenetration / 100);
                 isPenetrated = true;
             }
             else
             {
                 bulletPool.BackToPool(PoolType.regulerBullet, this.gameObject);
             }
         }
     }
     else if (collision.gameObject.tag == "Wall")
     {
         bulletPool.BackToPool(PoolType.regulerBullet, this.gameObject);
     }
 }