合并代码
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BuilderInsertPointToPoint : ModuleBuilder<DataInsertPoint, DataPoint> {
|
||||
|
||||
protected override void Awake() => ModuleCore.InsertPointToPoint = this;
|
||||
|
||||
public override DataPoint To(DataInsertPoint insertPoint) {
|
||||
Vector3 position = insertPoint.position - insertPoint.plate.position;
|
||||
|
||||
DataPoint point = new DataPoint(insertPoint.plate);
|
||||
point.frontBezier = DataPointTool.DefaultBezier(position, insertPoint.aPoint.position);
|
||||
point.position = position;
|
||||
point.afterBezier = DataPointTool.DefaultBezier(position, insertPoint.bPoint.position);
|
||||
|
||||
int index = insertPoint.plate.points.IndexOf(insertPoint.aPoint);
|
||||
insertPoint.plate.points.Insert(index + 1, point);
|
||||
insertPoint.plate.UpdateVisual();
|
||||
|
||||
return point;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 992dfa55aae34c040a024d7743bb1a8c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BuilderPlatePresetsToPlate : ModuleBuilder<DataPlatePresets, DataPlate> {
|
||||
|
||||
protected override void Awake() => ModuleCore.PlatePresetsToPlate = this;
|
||||
|
||||
public override DataPlate To(DataPlatePresets origin) {
|
||||
DataPlate dataPlate = new DataPlate();
|
||||
dataPlate.points = ToDataPoint(dataPlate, origin.designPoints);
|
||||
return dataPlate;
|
||||
}
|
||||
|
||||
private List<DataPoint> ToDataPoint(DataPlate dataPlate, List<Vector3> list) {
|
||||
List<DataPoint> points = new List<DataPoint>();
|
||||
|
||||
int maxIndex = list.Count - 1;
|
||||
|
||||
DataPoint start = new DataPoint(dataPlate);
|
||||
start.frontBezier = list[0] + DataPointTool.DefaultBezier(list[0], list[maxIndex]);
|
||||
start.position = list[0];
|
||||
start.afterBezier = list[0] + DataPointTool.DefaultBezier(list[0], list[1]);
|
||||
points.Add(start);
|
||||
|
||||
for (int i = 1; i < maxIndex; i++) {
|
||||
DataPoint dataPoint = new DataPoint(dataPlate);
|
||||
dataPoint.frontBezier = list[i] + DataPointTool.DefaultBezier(list[i], list[i - 1]);
|
||||
dataPoint.position = list[i];
|
||||
dataPoint.afterBezier = list[i] + DataPointTool.DefaultBezier(list[i], list[i + 1]);
|
||||
points.Add(dataPoint);
|
||||
}
|
||||
|
||||
DataPoint end = new DataPoint(dataPlate);
|
||||
end.frontBezier = list[maxIndex] + DataPointTool.DefaultBezier(list[maxIndex], list[maxIndex - 1]);
|
||||
end.position = list[maxIndex];
|
||||
end.afterBezier = list[maxIndex] + DataPointTool.DefaultBezier(list[maxIndex], list[0]);
|
||||
points.Add(end);
|
||||
|
||||
return points;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 476a9d6720db7284fae46d62e046095d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user