This commit is contained in:
MuHua-123
2024-11-29 18:10:02 +08:00
parent 84243e75a8
commit 698464b9d7
81 changed files with 3073 additions and 671 deletions
+5 -5
View File
@@ -5,17 +5,17 @@ using UnityEngine;
/// <summary>
/// 查找点
/// </summary>
public class FindPoint : ModuleFind<DataPoint> {
public class FindPoint : ModuleFind<DataPlatePoint> {
public readonly float FindRange = 0.01f;
/// <summary> 板片资产 </summary>
public ModuleAssets<DataPlate> AssetsPlate => ModuleCore.AssetsPlate;
protected override void Awake() => ModuleCore.FindPoint = this;
public override bool Find(Vector3 position, out DataPoint point) {
public override bool Find(Vector3 position, out DataPlatePoint point) {
List<DataPlate> plates = AssetsPlate.Datas;
for (int i = 0; i < plates.Count; i++) {
Vector3 localPosition = position - plates[i].designPosition;
Vector3 localPosition = position - plates[i].dataDesign.position;
point = Find(plates[i], localPosition);
if (point != null) { return true; }
}
@@ -23,8 +23,8 @@ public class FindPoint : ModuleFind<DataPoint> {
}
/// <summary> 查询匹配的点 </summary>
private DataPoint Find(DataPlate plate, Vector3 localPosition) {
List<DataPoint> points = plate.points;
private DataPlatePoint Find(DataPlate plate, Vector3 localPosition) {
List<DataPlatePoint> points = plate.platePoints;
for (int i = 0; i < points.Count; i++) {
float distance = Vector3.Distance(points[i].position, localPosition);
if (distance > FindRange) { continue; }