fix screen shake stacking and not resetting, fixes #1

item-info
John Montagu, the 4th Earl of Sandvich 2022-11-25 13:56:38 -08:00
parent 983dfba589
commit ce5789681c
1 changed files with 6 additions and 2 deletions

View File

@ -21,6 +21,10 @@ namespace SupaLidlGame.Utils
_timeLeft -= delta;
Offset = RandomOffset(_intensity);
}
else
{
Offset = Vector2.Zero;
}
if (_intensity > 0)
{
@ -30,8 +34,8 @@ namespace SupaLidlGame.Utils
public void Shake(float intensity, double time)
{
_intensity += intensity;
_timeLeft += time;
_intensity = Mathf.Max(_intensity, intensity);
_timeLeft = Math.Max(_timeLeft, time);
}
private Vector2 RandomOffset(float intensity)