初始化项目

This commit is contained in:
MuHua-123
2024-12-02 17:16:44 +08:00
parent 698464b9d7
commit 0ff284b795
327 changed files with 87 additions and 21751 deletions
-21
View File
@@ -1,21 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class LoopIndexTool {
/// <summary> 头尾循环标准化索引 </summary>
public static Data LoopIndex<Data>(this List<Data> list, int index) {
return list[LoopIndex(index, list.Count)];
}
/// <summary> 头尾循环标准化索引 </summary>
public static Data LoopIndex<Data>(this Data[] array, int index) {
return array[LoopIndex(index, array.Length)];
}
/// <summary> 头尾循环标准化索引 </summary>
public static int LoopIndex(int index, int maxIndex) {
if (maxIndex == 0) { Debug.LogError("错误索引:maxIndex = 0"); return 0; }
if (index < 0) { return LoopIndex(index + maxIndex, maxIndex); }
if (index >= maxIndex) { return LoopIndex(index - maxIndex, maxIndex); }
return index;
}
}