private void follow() { if (targetDirect == null) { calc.recalcClosestObject(this.transform, ref objectToFollow, RecalculationFPS, targetFromTag); } bool lockedOn = calc.isWithinRadius(this.transform, objectToFollow, EngageRadius); if (objectToFollow != null && lockedOn) { lastKnownPos = new Vector2(objectToFollow.position.x, objectToFollow.position.y); assigned = true; if (resetSwitch) { resetSwitch = false; } } if (objectToFollow == null || !lockedOn) { resetLinearAngle(); linear(); } else { moveTowards(); } setRotation(lockedOn); }
private void follow() { if (targetDirect == null) { calc.recalcClosestObject(this.transform, ref objectToFollow, RecalculationFPS, targetFromTag); } bool lockedOn = calc.isWithinRadius(this.transform, objectToFollow, EngageRadius); setRotation(objectToFollow, lockedOn); }