Example #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("HardObject"))
     {
         OnHit(false);
         SoundManager.instance.PlayEfx(Efx.HIT_HARD, transform.position);
         EffectManager.instance.Explode(other.ClosestPoint(transform.position), ExplosionType.HARD);
     }
     else if (other.CompareTag("SoftObject"))
     {
         OnHit(true);
         other.SendMessage("Damage");
         EffectManager.instance.Explode(other.ClosestPoint(transform.position), ExplosionType.SOFT);
     }
     else if (other.CompareTag("AirWall"))
     {
         AirWall airWall = other.GetComponent <AirWall>();
         if (airWall && AirWall.isBulletBlocked)
         {
             OnHit(false);
             SoundManager.instance.PlayEfx(Efx.HIT_HARD, transform.position);
             EffectManager.instance.Explode(other.ClosestPoint(transform.position), ExplosionType.HARD);
         }
     }
     else if (other.CompareTag("EnemyShield"))
     {
         OnHit(false);
         SoundManager.instance.PlayEfx(Efx.HIT_HARD_ENEMY, transform.position);
         EffectManager.instance.Explode(other.ClosestPoint(transform.position), ExplosionType.SOFT);
     }
     else if (other.CompareTag("Enemy"))
     {
         OnHit(true);
         other.GetComponent <Enemy>().Damage();
         EffectManager.instance.Explode(other.ClosestPoint(transform.position), ExplosionType.SOFT);
     }
     else if (other.CompareTag("EnemyBullet"))
     {
         EnemyBullet bullet = other.GetComponent <EnemyBullet>();
         if (bullet.canBeHitted)
         {
             OnHit(true);
             bullet.Damage();
         }
     }
 }