From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs | 83 ++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs (limited to 'Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs') 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; + } + } +} -- cgit v1.1-26-g67d0