start of some bullet support
This commit is contained in:
@@ -75,6 +75,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Actor.cs" />
|
<Compile Include="Actor.cs" />
|
||||||
|
<Compile Include="Bullet.cs" />
|
||||||
<Compile Include="Controller.cs" />
|
<Compile Include="Controller.cs" />
|
||||||
<Compile Include="Cursor.cs" />
|
<Compile Include="Cursor.cs" />
|
||||||
<Compile Include="GameRules\FieldLoader.cs" />
|
<Compile Include="GameRules\FieldLoader.cs" />
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
class World
|
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>>();
|
List<Action<World>> frameEndActions = new List<Action<World>>();
|
||||||
readonly Game game;
|
readonly Game game;
|
||||||
int lastTime = Environment.TickCount;
|
int lastTime = Environment.TickCount;
|
||||||
@@ -16,7 +17,11 @@ namespace OpenRa.Game
|
|||||||
public World(Game game) { this.game = game; }
|
public World(Game game) { this.game = game; }
|
||||||
|
|
||||||
public void Add(Actor a) { actors.Add(a); ActorAdded(a); }
|
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 void AddFrameEndTask( Action<World> a ) { frameEndActions.Add( a ); }
|
||||||
|
|
||||||
public event Action<Actor> ActorAdded = _ => { };
|
public event Action<Actor> ActorAdded = _ => { };
|
||||||
@@ -30,8 +35,10 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
lastTime += timestep;
|
lastTime += timestep;
|
||||||
|
|
||||||
foreach( Actor a in actors )
|
foreach( var a in actors )
|
||||||
a.Tick(game, timestep);
|
a.Tick(game, timestep);
|
||||||
|
foreach (var b in bullets)
|
||||||
|
b.Tick(game, timestep);
|
||||||
|
|
||||||
Renderer.waterFrame += 0.00125f * timestep;
|
Renderer.waterFrame += 0.00125f * timestep;
|
||||||
}
|
}
|
||||||
@@ -40,6 +47,7 @@ namespace OpenRa.Game
|
|||||||
frameEndActions.Clear();
|
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