Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CurveKey.cs
Go to the documentation of this file.
1using System;
4
6
9public class CurveKey : IEquatable<CurveKey>, IComparable<CurveKey>
10{
11 internal float position;
12
13 internal float internalValue;
14
15 internal float tangentOut;
16
17 internal float tangentIn;
18
20
21 public float Position => position;
22
23 public float Value
24 {
25 get
26 {
27 return internalValue;
28 }
29 set
30 {
32 }
33 }
34
35 public float TangentIn
36 {
37 get
38 {
39 return tangentIn;
40 }
41 set
42 {
44 }
45 }
46
47 public float TangentOut
48 {
49 get
50 {
51 return tangentOut;
52 }
53 set
54 {
56 }
57 }
58
60 {
61 get
62 {
63 return continuity;
64 }
65 set
66 {
68 }
69 }
70
71 public CurveKey(float position, float value)
72 {
73 this.position = position;
75 }
76
77 public CurveKey(float position, float value, float tangentIn, float tangentOut)
78 {
79 this.position = position;
81 this.tangentIn = tangentIn;
82 this.tangentOut = tangentOut;
83 }
84
86 {
87 this.position = position;
89 this.tangentIn = tangentIn;
90 this.tangentOut = tangentOut;
91 this.continuity = continuity;
92 }
93
98
99 public bool Equals(CurveKey other)
100 {
101 if (other != null && other.position == position && other.internalValue == internalValue && other.tangentIn == tangentIn && other.tangentOut == tangentOut)
102 {
103 return other.continuity == continuity;
104 }
105 return false;
106 }
107
108 public override bool Equals(object obj)
109 {
110 return Equals(obj as CurveKey);
111 }
112
113 public override int GetHashCode()
114 {
115 return position.GetHashCode() + internalValue.GetHashCode() + tangentIn.GetHashCode() + tangentOut.GetHashCode() + continuity.GetHashCode();
116 }
117
118 [SuppressMessage("Microsoft.Design", "CA1062")]
119 public static bool operator ==(CurveKey a, CurveKey b)
120 {
121 bool flag = false;
122 bool flag2 = (object)null == a;
123 bool flag3 = (object)null == b;
124 if (flag2 || flag3)
125 {
126 return flag2 == flag3;
127 }
128 return a.Equals(b);
129 }
130
131 public static bool operator !=(CurveKey a, CurveKey b)
132 {
133 bool flag = false;
134 bool flag2 = a == null;
135 bool flag3 = b == null;
136 if (flag2 || flag3)
137 {
138 return flag2 != flag3;
139 }
140 return a.position != b.position || a.internalValue != b.internalValue || a.tangentIn != b.tangentIn || a.tangentOut != b.tangentOut || a.continuity != b.continuity;
141 }
142
144 {
145 if (position != other.position)
146 {
147 if (!(position < other.position))
148 {
149 return 1;
150 }
151 return -1;
152 }
153 return 0;
154 }
155}
override bool Equals(object obj)
Definition CurveKey.cs:108
CurveKey(float position, float value)
Definition CurveKey.cs:71
CurveKey(float position, float value, float tangentIn, float tangentOut)
Definition CurveKey.cs:77
bool Equals(CurveKey other)
Definition CurveKey.cs:99
int CompareTo(CurveKey other)
Definition CurveKey.cs:143
CurveKey(float position, float value, float tangentIn, float tangentOut, CurveContinuity continuity)
Definition CurveKey.cs:85
static bool operator==(CurveKey a, CurveKey b)
Definition CurveKey.cs:119
static bool operator!=(CurveKey a, CurveKey b)
Definition CurveKey.cs:131