This commit is contained in:
MuHua-123
2025-01-13 16:19:03 +08:00
parent 8f387837db
commit 4f7a5d76ca
42 changed files with 328 additions and 83 deletions
+17
View File
@@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 图层遮罩工具
/// </summary>
public static class LayerMaskTool {
///// <summary> 板片 </summary>
//public static readonly LayerMask Plate = 1 << LayerMask.NameToLayer("Plate");
///// <summary> 形状 </summary>
//public static readonly LayerMask Shape = 1 << LayerMask.NameToLayer("Shape");
///// <summary> 安排点 </summary>
//public static readonly LayerMask Arrange = 1 << LayerMask.NameToLayer("Arrange");
///// <summary> 模特 </summary>
//public static readonly LayerMask Model = 1 << LayerMask.NameToLayer("Model");
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d32659481db1a124c9b564f885ee75a8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+21
View File
@@ -0,0 +1,21 @@
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;
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f410a5e521f087048804a823d1c02e6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: