diff options
| author | chai <215380520@qq.com> | 2024-05-19 17:03:57 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2024-05-19 17:03:57 +0800 |
| commit | cf58771365b5953c6eac548b172aae880d1f0acd (patch) | |
| tree | a49757a4b5c447cbf877584d482367a6bfe33b10 /Thronefall_1_57/Decompile/Ara/TrailSection.cs | |
| parent | eed315deae356ddfb17f28305e7cde6cdfc43313 (diff) | |
* rename
Diffstat (limited to 'Thronefall_1_57/Decompile/Ara/TrailSection.cs')
| -rw-r--r-- | Thronefall_1_57/Decompile/Ara/TrailSection.cs | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/Thronefall_1_57/Decompile/Ara/TrailSection.cs b/Thronefall_1_57/Decompile/Ara/TrailSection.cs deleted file mode 100644 index f530aef..0000000 --- a/Thronefall_1_57/Decompile/Ara/TrailSection.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace Ara; - -[CreateAssetMenu(menuName = "Ara Trails/Trail Section")] -public class TrailSection : ScriptableObject -{ - [HideInInspector] - public List<Vector2> vertices; - - public int snapX; - - public int snapY; - - public int Segments => vertices.Count - 1; - - public void OnEnable() - { - if (vertices == null) - { - vertices = new List<Vector2>(); - CirclePreset(8); - } - } - - public void CirclePreset(int segments) - { - vertices.Clear(); - for (int i = 0; i <= segments; i++) - { - float f = MathF.PI * 2f / (float)segments * (float)i; - vertices.Add(Mathf.Cos(f) * Vector2.right + Mathf.Sin(f) * Vector2.up); - } - } - - public static int SnapTo(float val, int snapInterval, int threshold) - { - int num = (int)val; - if (snapInterval <= 0) - { - return num; - } - int num2 = Mathf.FloorToInt(val / (float)snapInterval) * snapInterval; - int num3 = num2 + snapInterval; - if (num - num2 < threshold) - { - return num2; - } - if (num3 - num < threshold) - { - return num3; - } - return num; - } -} |
