void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         Debug.Log(collision.transform.name);
         if (collision.transform.name == "Head")
         {
             SBHEnemyControl enemyControl = collision.transform.parent.GetComponent <SBHEnemyControl>();
             enemyControl.HeadShot();
         }
         else if (collision.transform.name.Contains("Enemy"))
         {
             SBHEnemyControl enemyControl = collision.transform.GetComponent <SBHEnemyControl>();
             enemyControl.GunShot();
         }
     }
     else if (collision.gameObject.tag == "Unit")
     {
         SBHCivilianControl civilianControl = collision.transform.GetComponent <SBHCivilianControl>();
         civilianControl.GunShot();
     }
     else if (collision.gameObject.tag == "Obstacle")
     {
     }
     Destroy(this.gameObject);
 }
Ejemplo n.º 2
0
 private void ShootProcess(Transform target, bool isKillCivilian)
 {
     if (target.tag == "Enemy")
     {
         if (target.name == "Head")
         {
             SBHEnemyControl enemyControl = target.parent.GetComponent <SBHEnemyControl>();
             enemyControl.HeadShot();
         }
         else if (target.name.Contains("Enemy"))
         {
             SBHEnemyControl enemyControl = target.GetComponent <SBHEnemyControl>();
             enemyControl.GunShot();
         }
     }
     else if (target.tag == "Unit")
     {
         if (isKillCivilian)
         {
             SBHCivilianControl civilianControl = target.GetComponent <SBHCivilianControl>();
             civilianControl.GunShot();
         }
     }
     else if (target.tag == "Glass")
     {
         target.gameObject.SetActive(false);
         SBHSoundManger.Instance.PlayGlassAudio();
         Shoot(true);
     }
 }