Esempio n. 1
0
 private void HandleDetection()
 {
     if (mCurrentTarget == null)
     {
         Collider[] targets = Physics.OverlapSphere(transform.position, mFOVRadius, mControllerLayer);
         for (int i = 0; i < targets.Length; i++)
         {
             UnitController controller = targets[i].GetComponent <UnitController>();
             if (controller != null)
             {
                 if (controller.isDead)
                 {
                     continue;
                 }
                 Vector3 dir = controller.transform.position - transform.position;
                 dir.Normalize();
                 float angle = Vector3.Angle(dir, transform.forward);
                 if (angle < mFOVAngle)
                 {
                     if (mIsPlayer)
                     {
                         if (!controller.mIsPlayer)
                         {
                             CheckForOpponent(controller, dir);
                         }
                     }
                     else
                     {
                         if (controller.mIsPlayer)
                         {
                             //CheckForOpponent(controller, dir);
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public void RegisterUnits(UnitController pUnitController)
 {
     mPlayerUnits.Add(pUnitController);
 }