summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/FloatCurve.cs
blob: 8e970cf23c221a79afa866fbba35ccba04af3ec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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;
		}
	}
}