Esempio n. 1
0
 /**
  * This method calculates if the enemy has line of sight to the player
  */
 private bool PlayerInLineOfSight()
 {
     //Raycast between the player and the enemy
     if (Physics.Raycast(model.AttackPoint.position, model.AttackPoint.forward, out RaycastHit hit, model.sightRange))
     {
         //If the raycast hits the player then it has line of sight
         if (hit.transform.CompareTag("Player"))
         {
             if (model.isBoss && !bossHealthScript.isHealthBarActive)
             {
                 bossHealthScript.ShowHealthBar();
             }
             return(true);
         }
     }
     return(false);
 }