Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TransAnimeData.cs
Go to the documentation of this file.
1using UnityEngine;
2
3public class TransAnimeData : ScriptableObject
4{
5 public int frames;
6
7 public int count = 1;
8
9 public float interval;
10
11 public float mtp;
12
13 public float randomMtp;
14
15 public float randomDelay;
16
17 public bool loop;
18
19 public bool generate;
20
21 public bool directional;
22
23 public bool realtimeGenerate;
24
25 public bool randomFlipX;
26
27 public Vector3 offset;
28
29 public Vector3[] vectors;
30
31 public AnimationCurve curveX;
32
33 public AnimationCurve curveY;
34
35 public AnimationCurve curveZ;
36
37 public int TotalFrame => frames * count;
38
39 public void Awake()
40 {
41 if (generate)
42 {
43 Generate();
44 }
45 }
46
47 public void Generate()
48 {
49 vectors = new Vector3[TotalFrame];
50 for (int i = 0; i < count; i++)
51 {
52 for (int j = 0; j < frames; j++)
53 {
54 float time = 1f / (float)frames * (float)j;
55 Vector3 vector = (new Vector3(curveX.Evaluate(time), curveY.Evaluate(time), curveZ.Evaluate(time)) + offset) * mtp;
56 vectors[i * frames + j] = vector;
57 }
58 }
59 }
60
61 public Vector3 GetVector(int frame)
62 {
63 return vectors[frame];
64 }
65
66 private void OnValidate()
67 {
69 {
70 Generate();
71 }
72 }
73
74 public void SwapXY()
75 {
76 AnimationCurve animationCurve = curveX;
77 curveX = curveY;
78 curveY = animationCurve;
79 }
80}
Vector3[] vectors
AnimationCurve curveZ
Vector3 GetVector(int frame)
AnimationCurve curveX
AnimationCurve curveY