Begin generalizing crates; only give firepower bonus to units with weapons

This commit is contained in:
Paul Chote
2010-03-21 19:52:13 +13:00
parent a489b4aa56
commit 0510a7fb7f
8 changed files with 50 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
@@ -27,6 +27,8 @@ namespace OpenRA.Mods.RA
{
public float Multiplier = 1.7f;
public int SelectionShares = 10;
public string Effect = null;
public string Notification = null;
public object Create(Actor self) { return new SpeedUpgradeCrateAction(self); }
}
@@ -38,19 +40,20 @@ namespace OpenRA.Mods.RA
this.self = self;
}
public int SelectionShares
public int GetSelectionShares(Actor collector)
{
get { return self.Info.Traits.Get<SpeedUpgradeCrateActionInfo>().SelectionShares; }
return self.Info.Traits.Get<SpeedUpgradeCrateActionInfo>().SelectionShares;
}
public void Activate(Actor collector)
{
Sound.PlayToPlayer(collector.Owner, "unitspd1.aud");
Sound.PlayToPlayer(collector.Owner, self.Info.Traits.Get<SpeedUpgradeCrateActionInfo>().Notification);
collector.World.AddFrameEndTask(w =>
{
var multiplier = self.Info.Traits.Get<SpeedUpgradeCrateActionInfo>().Multiplier;
collector.traits.Add(new SpeedUpgrade(multiplier));
w.Add(new CrateEffect(collector, "speed"));
w.Add(new CrateEffect(collector, self.Info.Traits.Get<SpeedUpgradeCrateActionInfo>().Effect));
});
}
}