This commit is contained in:
Chris Forbes
2010-02-27 19:41:39 +13:00
parent 5dc240d390
commit 0d0000a67b

View File

@@ -9,7 +9,7 @@ namespace OpenRa.Traits
{
class ScreenShakerInfo : ITraitInfo
{
public object Create( Actor self ) { return new ScreenShaker( self ); }
public object Create( Actor self ) { return new ScreenShaker(); }
}
public class ScreenShaker : ITick
@@ -17,23 +17,11 @@ namespace OpenRa.Traits
static int ticks = 0;
static List<Tuple<int, float2, int>> shakeEffects = new List<Tuple<int, float2, int>>();
public ScreenShaker (Actor self){}
public void Tick (Actor self)
{
Game.viewport.Scroll(getScrollOffset());
UpdateList();
ticks++;
}
void UpdateList()
{
var toRemove = new List<Tuple<int, float2, int>>();
Game.viewport.Scroll(getScrollOffset());
shakeEffects.RemoveAll(t => t.a == ticks);
foreach(Tuple<int, float2, int> t in toRemove){
shakeEffects.Remove(t);
}
ticks++;
}
public static void RegisterShakeEffect(int time, float2 position, int intensity)