added 'give cash' crate
This commit is contained in:
36
OpenRa.Mods.RA/Crate Actions/GiveCashCrateAction.cs
Normal file
36
OpenRa.Mods.RA/Crate Actions/GiveCashCrateAction.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using OpenRa.Mods.RA.Effects;
|
||||
using OpenRa.Traits;
|
||||
|
||||
namespace OpenRa.Mods.RA
|
||||
{
|
||||
class GiveCashCrateActionInfo : ITraitInfo
|
||||
{
|
||||
public int Amount = 2000;
|
||||
public int SelectionShares = 10;
|
||||
public object Create(Actor self) { return new GiveCashCrateAction(self); }
|
||||
}
|
||||
|
||||
class GiveCashCrateAction : ICrateAction
|
||||
{
|
||||
Actor self;
|
||||
public GiveCashCrateAction(Actor self)
|
||||
{
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
public int SelectionShares
|
||||
{
|
||||
get { return self.Info.Traits.Get<GiveCashCrateActionInfo>().SelectionShares; }
|
||||
}
|
||||
|
||||
public void Activate(Actor collector)
|
||||
{
|
||||
collector.World.AddFrameEndTask(w =>
|
||||
{
|
||||
var amount = self.Info.Traits.Get<GiveCashCrateActionInfo>().Amount;
|
||||
collector.Owner.GiveCash(amount);
|
||||
w.Add(new CrateEffect(collector, "dollar"));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ namespace OpenRa.Mods.RA
|
||||
public int SelectionShares = 10;
|
||||
public object Create(Actor self) { return new SpeedUpgradeCrateAction(self); }
|
||||
}
|
||||
|
||||
class SpeedUpgradeCrateAction : ICrateAction
|
||||
{
|
||||
Actor self;
|
||||
@@ -52,6 +52,7 @@
|
||||
<Compile Include="Activities\LayMine.cs" />
|
||||
<Compile Include="Activities\Steal.cs" />
|
||||
<Compile Include="C4Demolition.cs" />
|
||||
<Compile Include="Crate Actions\GiveCashCrateAction.cs" />
|
||||
<Compile Include="Effects\CrateEffect.cs" />
|
||||
<Compile Include="Effects\GpsSatellite.cs" />
|
||||
<Compile Include="Effects\InvulnEffect.cs" />
|
||||
@@ -71,7 +72,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RenderSpy.cs" />
|
||||
<Compile Include="RepairableNear.cs" />
|
||||
<Compile Include="Crate Actions\SpeedUpgrade.cs" />
|
||||
<Compile Include="Crate Actions\SpeedUpgradeCrateAction.cs" />
|
||||
<Compile Include="SonarPulsePower.cs" />
|
||||
<Compile Include="Spy.cs" />
|
||||
<Compile Include="SpyPlanePower.cs" />
|
||||
|
||||
Reference in New Issue
Block a user