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