@@ -135,55 +135,26 @@ public static bool WithInAcceptRange(float range, float acceptRange, float curre
135135 /// <returns></returns>
136136 public static bool WithInRange ( float minRange , float maxRange , float currentVal )
137137 {
138- if ( currentVal >= minRange && currentVal <= maxRange )
139- return true ;
140- return false ;
141- }
142-
143- /// <summary>
144- /// With in array range. (Array)
145- /// </summary>
146- /// <returns></returns>
147- public static bool WithInRange < T > ( int index , T [ ] arr )
148- {
149- return index >= 0 && index < arr . Length ;
138+ return ( currentVal >= minRange && currentVal <= maxRange ) ;
150139 }
151140
152141 /// <summary>
153- /// With in array range. (List)
142+ /// With in collection range.
154143 /// </summary>
155144 /// <returns></returns>
156- public static bool WithInRange < T > ( int index , List < T > arr )
145+ public static bool WithInRange < T > ( int index , ICollection < T > arr )
157146 {
158147 return index >= 0 && index < arr . Count ;
159148 }
160149
161150 /// <summary>
162- /// Loop in an array. (Array)
163- /// </summary>
164- /// <typeparam name="T"> Type. </typeparam>
165- /// <param name="index"> Index </param>
166- /// <param name="arr"> Array. </param>
167- /// <returns> index that looped. </returns>
168- public static int LoopIn < T > ( int index , T [ ] arr )
169- {
170- // loop through the array, if at the tail of the array set it to head.
171- if ( index < 0 )
172- index = arr . Length - 1 ;
173- // loop through the array, if at head of the array we set it to the tail.
174- else if ( index >= arr . Length )
175- index = 0 ;
176- return index ;
177- }
178-
179- /// <summary>
180- /// Loop in an array. (List)
151+ /// Loop in a collection.
181152 /// </summary>
182153 /// <typeparam name="T"> Type. </typeparam>
183154 /// <param name="index"> Index </param>
184155 /// <param name="arr"> List. </param>
185156 /// <returns> index that looped. </returns>
186- public static int LoopIn < T > ( int index , List < T > arr )
157+ public static int LoopIn < T > ( int index , ICollection < T > arr )
187158 {
188159 // loop through the array, if at the tail of the array set it to head.
189160 if ( index < 0 )
0 commit comments