Esempio n. 1
0
 private void Fire()
 {
     ray.origin    = aimPoint.position;
     ray.direction = aimPoint.forward;
     if (Physics.Raycast(ray, out raycastHit, gunShellController.GunShot))
     {
         EnemyHealthManager healthManager = raycastHit.transform.GetComponent <EnemyHealthManager>();
         if (raycastHit.transform.tag == "Enemy" || raycastHit.transform.tag == "EnemyHead")
         {
             healthManager.UnderAttack(transform.position, raycastHit.point, gunShellController.GunDamage);
         }
         spark.transform.position = raycastHit.point;
         spark.Play();
     }
 }