pulling IEffect out of Bullet in prep for Explosion
This commit is contained in:
@@ -8,9 +8,16 @@ using OpenRa.Game.Graphics;
|
|||||||
|
|
||||||
namespace OpenRa.Game
|
namespace OpenRa.Game
|
||||||
{
|
{
|
||||||
class Bullet
|
interface IEffect
|
||||||
{
|
{
|
||||||
public readonly Player Owner;
|
void Tick(Game g);
|
||||||
|
IEnumerable<Pair<Sprite, float2>> Render();
|
||||||
|
Player Owner { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Bullet : IEffect
|
||||||
|
{
|
||||||
|
public Player Owner { get; private set; }
|
||||||
readonly Actor FiredBy;
|
readonly Actor FiredBy;
|
||||||
readonly WeaponInfo Weapon;
|
readonly WeaponInfo Weapon;
|
||||||
readonly ProjectileInfo Projectile;
|
readonly ProjectileInfo Projectile;
|
||||||
@@ -49,7 +56,10 @@ namespace OpenRa.Game
|
|||||||
t += 40;
|
t += 40;
|
||||||
|
|
||||||
if (t > TotalTime()) /* remove finished bullets */
|
if (t > TotalTime()) /* remove finished bullets */
|
||||||
|
{
|
||||||
game.world.AddFrameEndTask(w => w.Remove(this));
|
game.world.AddFrameEndTask(w => w.Remove(this));
|
||||||
|
game.PlaySound("kaboom25.aud", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Pair<Sprite, float2>> Render()
|
public IEnumerable<Pair<Sprite, float2>> Render()
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace OpenRa.Game.Graphics
|
|||||||
foreach (Actor a in game.world.Actors)
|
foreach (Actor a in game.world.Actors)
|
||||||
DrawSpriteList(a.Owner, rect, a.Render());
|
DrawSpriteList(a.Owner, rect, a.Render());
|
||||||
|
|
||||||
foreach (Bullet b in game.world.Bullets)
|
foreach (IEffect e in game.world.Bullets)
|
||||||
DrawSpriteList(b.Owner, rect, b.Render());
|
DrawSpriteList(e.Owner, rect, e.Render());
|
||||||
|
|
||||||
uiOverlay.Draw();
|
uiOverlay.Draw();
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ using System.Runtime.InteropServices;
|
|||||||
game.world.Add( jeep );
|
game.world.Add( jeep );
|
||||||
var tank = new Actor( "3tnk", new int2( 12, 7 ), game.players[ 1 ] );
|
var tank = new Actor( "3tnk", new int2( 12, 7 ), game.players[ 1 ] );
|
||||||
game.world.Add( tank );
|
game.world.Add( tank );
|
||||||
//tank.traits.Get<Traits.AttackTurreted>().target = jeep;
|
tank.traits.Get<Traits.AttackTurreted>().target = jeep;
|
||||||
|
|
||||||
sidebar = new Sidebar(renderer, game);
|
sidebar = new Sidebar(renderer, game);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ 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<IEffect> bullets = new List<IEffect>();
|
||||||
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;
|
||||||
@@ -53,6 +53,6 @@ namespace OpenRa.Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Actor> Actors { get { return actors; } }
|
public IEnumerable<Actor> Actors { get { return actors; } }
|
||||||
public IEnumerable<Bullet> Bullets { get { return bullets; } }
|
public IEnumerable<IEffect> Bullets { get { return bullets; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user