(d9829ac) v0.9.4.0
This commit is contained in:
@@ -89,11 +89,22 @@ namespace Barotrauma
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
public static Color GradientLerp(float t, params Color[] gradient)
|
||||
{
|
||||
if (t <= 0.0f) return gradient[0];
|
||||
if (t >= 1.0f) return gradient[gradient.Length - 1];
|
||||
System.Diagnostics.Debug.Assert(gradient.Length > 0, "Empty color array passed to the GradientLerp method");
|
||||
if (gradient.Length == 0)
|
||||
{
|
||||
#if DEBUG
|
||||
DebugConsole.ThrowError("Empty color array passed to the GradientLerp method.\n" + Environment.StackTrace);
|
||||
#endif
|
||||
GameAnalyticsManager.AddErrorEventOnce("ToolBox.GradientLerp:EmptyColorArray", GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
||||
"Empty color array passed to the GradientLerp method.\n" + Environment.StackTrace);
|
||||
return Color.Black;
|
||||
}
|
||||
|
||||
if (t <= 0.0f) { return gradient[0]; }
|
||||
if (t >= 1.0f) { return gradient[gradient.Length - 1]; }
|
||||
|
||||
float scaledT = t * (gradient.Length - 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user