start of some bullet support
This commit is contained in:
@@ -7,7 +7,8 @@ namespace OpenRa.Game
|
||||
{
|
||||
class World
|
||||
{
|
||||
List<Actor> actors = new List<Actor>();
|
||||
List<Actor> actors = new List<Actor>();
|
||||
List<Bullet> bullets = new List<Bullet>();
|
||||
List<Action<World>> frameEndActions = new List<Action<World>>();
|
||||
readonly Game game;
|
||||
int lastTime = Environment.TickCount;
|
||||
@@ -16,7 +17,11 @@ namespace OpenRa.Game
|
||||
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); }
|
||||
public void Remove(Actor a) { actors.Remove(a); ActorRemoved(a); }
|
||||
|
||||
public void Add(Bullet b) { bullets.Add(b); }
|
||||
public void Remove(Bullet b) { bullets.Remove(b); }
|
||||
|
||||
public void AddFrameEndTask( Action<World> a ) { frameEndActions.Add( a ); }
|
||||
|
||||
public event Action<Actor> ActorAdded = _ => { };
|
||||
@@ -30,8 +35,10 @@ namespace OpenRa.Game
|
||||
{
|
||||
lastTime += timestep;
|
||||
|
||||
foreach( Actor a in actors )
|
||||
foreach( var a in actors )
|
||||
a.Tick(game, timestep);
|
||||
foreach (var b in bullets)
|
||||
b.Tick(game, timestep);
|
||||
|
||||
Renderer.waterFrame += 0.00125f * timestep;
|
||||
}
|
||||
@@ -40,6 +47,7 @@ namespace OpenRa.Game
|
||||
frameEndActions.Clear();
|
||||
}
|
||||
|
||||
public IEnumerable<Actor> Actors { get { return actors; } }
|
||||
public IEnumerable<Actor> Actors { get { return actors; } }
|
||||
public IEnumerable<Bullet> Bullets { get { return bullets; } }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user