1
This commit is contained in:
@@ -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");
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d32659481db1a124c9b564f885ee75a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f410a5e521f087048804a823d1c02e6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user