made crate upgrade effect generic
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRa.Mods.RA.Effects;
|
||||
using OpenRa.Traits;
|
||||
using OpenRa.Mods.RA.Effects;
|
||||
|
||||
namespace OpenRa.Mods.RA
|
||||
{
|
||||
@@ -32,7 +29,7 @@ namespace OpenRa.Mods.RA
|
||||
{
|
||||
float multiplier = self.Info.Traits.Get<SpeedUpgradeCrateActionInfo>().Multiplier;
|
||||
collector.traits.Add(new SpeedUpgrade(multiplier));
|
||||
w.Add(new CrateEffectSpeedUpgrade(collector));
|
||||
w.Add(new CrateEffect(collector, "speed"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
32
OpenRa.Mods.RA/Effects/CrateEffect.cs
Normal file
32
OpenRa.Mods.RA/Effects/CrateEffect.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenRa.Effects;
|
||||
using OpenRa.Graphics;
|
||||
using OpenRa.Traits;
|
||||
|
||||
namespace OpenRa.Mods.RA.Effects
|
||||
{
|
||||
class CrateEffect : IEffect
|
||||
{
|
||||
Actor a;
|
||||
Animation anim = new Animation("crate-effects");
|
||||
float2 doorOffset = new float2(-4,0);
|
||||
|
||||
public CrateEffect(Actor a, string seq)
|
||||
{
|
||||
this.a = a;
|
||||
anim.PlayThen(seq,
|
||||
() => a.World.AddFrameEndTask(w => w.Remove(this)));
|
||||
}
|
||||
|
||||
public void Tick( World world )
|
||||
{
|
||||
anim.Tick();
|
||||
}
|
||||
|
||||
public IEnumerable<Renderable> Render()
|
||||
{
|
||||
yield return new Renderable(anim.Image,
|
||||
a.CenterLocation - .5f * anim.Image.size + doorOffset, PaletteType.Gold);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
<Compile Include="Activities\LayMine.cs" />
|
||||
<Compile Include="Activities\Steal.cs" />
|
||||
<Compile Include="C4Demolition.cs" />
|
||||
<Compile Include="Effects\CrateEffectSpeedUpgrade.cs" />
|
||||
<Compile Include="Effects\CrateEffect.cs" />
|
||||
<Compile Include="Effects\Parachute.cs" />
|
||||
<Compile Include="EngineerCapture.cs" />
|
||||
<Compile Include="InfiltrateForSonarPulse.cs" />
|
||||
|
||||
Reference in New Issue
Block a user