Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions EXILED/Exiled.API/Extensions/CommonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ public static T GetRandomValue<T>(this IEnumerable<T> enumerable, System.Func<T,
/// <returns>The new modfied curve.</returns>
public static AnimationCurve Multiply(this AnimationCurve curve, float amount)
{
for (int i = 0; i < curve.length; i++)
curve.keys[i].value *= amount;
Keyframe[] keys = curve.keys;
for (int i = 0; i < keys.Length; i++)
keys[i].value *= amount;

curve.keys = keys;
return curve;
}

Expand All @@ -70,9 +72,11 @@ public static AnimationCurve Multiply(this AnimationCurve curve, float amount)
/// <returns>The new modfied curve.</returns>
public static AnimationCurve Add(this AnimationCurve curve, float amount)
{
for (int i = 0; i < curve.length; i++)
curve.keys[i].value += amount;
Keyframe[] keys = curve.keys;
for (int i = 0; i < keys.Length; i++)
keys[i].value += amount;

curve.keys = keys;
return curve;
}
}
Expand Down