Spatially partition NukeLaunch effect
This commit is contained in:
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Effects
|
namespace OpenRA.Mods.Common.Effects
|
||||||
{
|
{
|
||||||
public class NukeLaunch : IProjectile
|
public class NukeLaunch : IProjectile, ISpatiallyPartitionable
|
||||||
{
|
{
|
||||||
readonly Player firedBy;
|
readonly Player firedBy;
|
||||||
readonly Animation anim;
|
readonly Animation anim;
|
||||||
@@ -64,6 +64,8 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
|
|
||||||
if (skipAscent)
|
if (skipAscent)
|
||||||
ticks = turn;
|
ticks = turn;
|
||||||
|
|
||||||
|
firedBy.World.ScreenMap.Add(this, pos, anim.Image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
@@ -81,12 +83,14 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
if (ticks == delay)
|
if (ticks == delay)
|
||||||
Explode(world);
|
Explode(world);
|
||||||
|
|
||||||
|
world.ScreenMap.Update(this, pos, anim.Image);
|
||||||
|
|
||||||
ticks++;
|
ticks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Explode(World world)
|
void Explode(World world)
|
||||||
{
|
{
|
||||||
world.AddFrameEndTask(w => w.Remove(this));
|
world.AddFrameEndTask(w => { w.Remove(this); w.ScreenMap.Remove(this); });
|
||||||
weapon.Impact(Target.FromPos(pos), firedBy.PlayerActor, Enumerable.Empty<int>());
|
weapon.Impact(Target.FromPos(pos), firedBy.PlayerActor, Enumerable.Empty<int>());
|
||||||
world.WorldActor.Trait<ScreenShaker>().AddEffect(20, pos, 5);
|
world.WorldActor.Trait<ScreenShaker>().AddEffect(20, pos, 5);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user