pushed bibs down into the smudge layer; made Game static

This commit is contained in:
Chris Forbes
2009-10-20 20:47:04 +13:00
parent e41e74e609
commit a4c344523f
26 changed files with 201 additions and 202 deletions

View File

@@ -10,12 +10,9 @@ namespace OpenRa.Game
List<Actor> actors = new List<Actor>();
List<IEffect> effects = new List<IEffect>();
List<Action<World>> frameEndActions = new List<Action<World>>();
readonly Game game;
int lastTime = Environment.TickCount;
const int timestep = 40;
public World(Game game) { this.game = game; }
public void Add(Actor a) { actors.Add(a); ActorAdded(a); }
public void Remove(Actor a) { actors.Remove(a); ActorRemoved(a); }
@@ -35,17 +32,15 @@ namespace OpenRa.Game
public void Update()
{
int t = Environment.TickCount;
int dt = t - lastTime;
if( dt >= timestep )
{
lastTime += timestep;
foreach( var a in actors )
a.Tick(game);
foreach (var b in effects)
b.Tick(game);
Renderer.waterFrame += 0.00125f * timestep;
int dt = t - lastTime;
if (dt >= timestep)
{
lastTime += timestep;
foreach (var a in actors) a.Tick();
foreach (var e in effects) e.Tick();
Renderer.waterFrame += 0.00125f * timestep;
}
foreach (Action<World> a in frameEndActions) a(this);