public static IEnumerable <IntVector2> Basic(Transform transform) { if (!transform.TryGetClosestPlayerTransform(out var playerTransform)) { yield break; } var orientation = transform.orientation; var diff = playerTransform.position - transform.position; var diff_ones = diff.Sign(); var diff_x = new IntVector2(diff_ones.x, 0); var diff_y = new IntVector2(0, diff_ones.y); // The difference is not diagonal if (diff_ones.x == 0) { yield return(diff_y); } else if (diff_ones.y == 0) { yield return(diff_x); } // the difference is diagonal else { int dot_x = diff_x.Dot(orientation); int dot_y = diff_y.Dot(orientation); if (dot_x >= dot_y) { yield return(diff_x); yield return(diff_y); } else { yield return(diff_y); yield return(diff_x); } } }