Files
2026-02-21 16:45:37 +08:00

72 lines
1.7 KiB
C#

using System;
using UnityEngine;
[Serializable]
public class Warp
{
public string name = "None";
public Vector3[] points = new Vector3[16];
public void GetWarp(MegaBezPatch mod)
{
mod.p11 = points[0];
mod.p12 = points[1];
mod.p13 = points[2];
mod.p14 = points[3];
mod.p21 = points[4];
mod.p22 = points[5];
mod.p23 = points[6];
mod.p24 = points[7];
mod.p31 = points[8];
mod.p32 = points[9];
mod.p33 = points[10];
mod.p34 = points[11];
mod.p41 = points[12];
mod.p42 = points[13];
mod.p43 = points[14];
mod.p44 = points[15];
}
public void SetWarp(MegaBezPatch mod)
{
points[0] = mod.p11;
points[1] = mod.p12;
points[2] = mod.p13;
points[3] = mod.p14;
points[4] = mod.p21;
points[5] = mod.p22;
points[6] = mod.p23;
points[7] = mod.p24;
points[8] = mod.p31;
points[9] = mod.p32;
points[10] = mod.p33;
points[11] = mod.p34;
points[12] = mod.p41;
points[13] = mod.p42;
points[14] = mod.p43;
points[15] = mod.p44;
}
public void AdjustLattice(float wr, float hr)
{
Vector3 b = new Vector3(wr, hr, 1f);
points[0] = Vector3.Scale(points[0], b);
points[1] = Vector3.Scale(points[1], b);
points[2] = Vector3.Scale(points[2], b);
points[3] = Vector3.Scale(points[3], b);
points[4] = Vector3.Scale(points[4], b);
points[5] = Vector3.Scale(points[5], b);
points[6] = Vector3.Scale(points[6], b);
points[7] = Vector3.Scale(points[7], b);
points[8] = Vector3.Scale(points[8], b);
points[9] = Vector3.Scale(points[9], b);
points[10] = Vector3.Scale(points[10], b);
points[11] = Vector3.Scale(points[11], b);
points[12] = Vector3.Scale(points[12], b);
points[13] = Vector3.Scale(points[13], b);
points[14] = Vector3.Scale(points[14], b);
points[15] = Vector3.Scale(points[15], b);
}
}