namespace EscapeRoomEngine.Engine.Runtime.Utilities { /// /// This struct represents an integer range. /// public struct Range { public int min, max; /// /// The length of the range, excluding the maximum value. /// public int Length => max - min; public Range(int min, int max) { this.min = min; this.max = max; } /// /// Create an array of every value in this range. /// public int[] ToArray(bool includeMax = false) { var count = includeMax ? Length + 1 : Length; var array = new int[count]; for (var i = 0; i < count; i++) { array[i] = min + i; } return array; } public override string ToString() => $"{{{min}, ..., {max}}}"; } }