void Awake()
 {
     aiSight   = GetComponent <AISightAndHearing>();
     nav       = GetComponent <UnityEngine.AI.NavMeshAgent>();
     mov       = GetComponent <Movement_Handler>();
     deadZone *= Mathf.Deg2Rad;
 }
示例#2
0
 void Awake()
 {
     movHdlr      = GetComponent <Movement_Handler> ();
     aiPerception = GetComponent <AISightAndHearing> ();
     nav          = GetComponent <UnityEngine.AI.NavMeshAgent> ();
     wep          = GetComponent <Weapon_Handler> ();
     currWep      = wep.GetCurrWeapon();
     fireAtWill   = true;
     holdPosition = true;
     follow       = false;
     currWep      = wep.GetCurrWeapon();
 }
 public void MakeNoise(float radius)
 {
     Collider[] otherObjects = Physics.OverlapSphere(transform.position, radius);
     foreach (Collider c in otherObjects)
     {
         if ((c.tag == "Enemy" || c.tag == "Player") & c != GetComponent <Collider>() & !c.isTrigger)
         {
             Vector3 currPos = transform.position;
             currPos.y = 0;
             AISightAndHearing AIP = c.GetComponent <AISightAndHearing>();
             if (AIP)
             {
                 if (gameObject.tag == AIP.opponent)
                 {
                     AIP.HeardSomething(currPos);
                 }
             }
         }
     }
 }