tidy up SiloBarWidget to be almost completely independent of ore

This commit is contained in:
Chris Forbes
2012-09-25 19:02:18 +12:00
parent 8b6308d3a2
commit af31ae4931
3 changed files with 42 additions and 21 deletions

View File

@@ -101,4 +101,18 @@ namespace OpenRA
public float LengthSquared { get { return X * X + Y * Y; } }
public float Length { get { return (float)Math.Sqrt(LengthSquared); } }
}
public class EWMA
{
readonly float animRate;
float? value;
public EWMA(float animRate) { this.animRate = animRate; }
public float Update(float newValue)
{
value = float2.Lerp(value ?? newValue, newValue, animRate);
return value.Value;
}
}
}