pulling IEffect out of Bullet in prep for Explosion

This commit is contained in:
Chris Forbes
2009-10-20 18:21:42 +13:00
parent 5a67220f0e
commit 1bc3fc22c6
4 changed files with 24 additions and 14 deletions

View File

@@ -4,13 +4,20 @@ using System.Linq;
using System.Text;
using OpenRa.Game.GameRules;
using IjwFramework.Types;
using OpenRa.Game.Graphics;
using OpenRa.Game.Graphics;
namespace OpenRa.Game
{
class Bullet
{
public readonly Player Owner;
{
interface IEffect
{
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 WeaponInfo Weapon;
readonly ProjectileInfo Projectile;
@@ -46,10 +53,13 @@ namespace OpenRa.Game
if (t == 0)
game.PlaySound(Weapon.Report + ".aud", false);
t += 40;
if (t > TotalTime()) /* remove finished bullets */
game.world.AddFrameEndTask(w => w.Remove(this));
t += 40;
if (t > TotalTime()) /* remove finished bullets */
{
game.world.AddFrameEndTask(w => w.Remove(this));
game.PlaySound("kaboom25.aud", false);
}
}
public IEnumerable<Pair<Sprite, float2>> Render()