avoid calling Viewport.Scroll on every ScreenShaker.Tick

This commit is contained in:
Paolo Chiodi
2010-09-04 10:35:33 +02:00
parent 1c8f744719
commit 2c388308c7

View File

@@ -22,9 +22,11 @@ namespace OpenRA.Traits
List<ShakeEffect> shakeEffects = new List<ShakeEffect>();
public void Tick (Actor self)
{
Game.viewport.Scroll(GetScrollOffset(), true);
shakeEffects.RemoveAll(t => t.ExpiryTime == ticks);
{
if(shakeEffects.Any()){
Game.viewport.Scroll(GetScrollOffset(), true);
shakeEffects.RemoveAll(t => t.ExpiryTime == ticks);
}
ticks++;
}