示例#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();
     }
 }
示例#2
0
 public EnemyInfo(GameObject enemy)
 {
     this.enemy  = enemy;
     enemyHealth = enemy.GetComponent <EnemyHealthManager>();
     fly         = false;
 }