diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs')
-rw-r--r-- | Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs b/Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs new file mode 100644 index 00000000..8e970cf2 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs @@ -0,0 +1,83 @@ +using System;
+
+namespace XUtliPoolLib
+{
+ public class FloatCurve : IXCurve
+ {
+ public int length
+ {
+ get
+ {
+ return (this.value == null) ? 0 : this.value.Length;
+ }
+ }
+
+ public static float frameTime = 0.0333333351f;
+
+ public uint namehash;
+
+ public short maxValue;
+
+ public short landValue;
+
+ public short[] value = null;
+
+ public float Evaluate(float time)
+ {
+ bool flag = this.value == null;
+ float result;
+ if (flag)
+ {
+ result = 0f;
+ }
+ else
+ {
+ float num = time / FloatCurve.frameTime;
+ int num2 = (int)Math.Ceiling((double)num);
+ int num3 = (int)Math.Floor((double)num);
+ bool flag2 = num2 >= this.value.Length;
+ if (flag2)
+ {
+ num2 = this.value.Length - 1;
+ }
+ bool flag3 = num3 >= this.value.Length;
+ if (flag3)
+ {
+ num3 = this.value.Length - 1;
+ }
+ result = (float)this.value[num3] * 0.01f + (float)(this.value[num2] - this.value[num3]) * 0.01f / FloatCurve.frameTime * (time - (float)num3 * FloatCurve.frameTime);
+ }
+ return result;
+ }
+
+ public float GetValue(int index)
+ {
+ bool flag = this.value == null;
+ float result;
+ if (flag)
+ {
+ result = 0f;
+ }
+ else
+ {
+ result = (float)this.value[index] * 0.01f;
+ }
+ return result;
+ }
+
+ public float GetTime(int index)
+ {
+ return (float)index * FloatCurve.frameTime;
+ }
+
+ public float GetMaxValue()
+ {
+ return (float)this.maxValue * 0.01f;
+ }
+
+ public float GetLandValue()
+ {
+ return (float)this.landValue * 0.01f;
+ }
+ }
+}
|