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); } } } } } } }
public void RegisterUnits(UnitController pUnitController) { mPlayerUnits.Add(pUnitController); }