private void Update() { if (Vision.UnitOfInterest() != null) { CurrentTarget = Vision.UnitOfInterest(); } else { CurrentTarget = Vision.SecondaryUnitOfInterest(); } if (CurrentTarget != null && GameUnit.InReach(CurrentTarget)) { Vector3 dir = CurrentTarget.transform.position - transform.position; Quaternion rot = Quaternion.LookRotation(dir); transform.rotation = Quaternion.Slerp(transform.rotation, rot, 2.5f * Time.deltaTime); Attack(); } }