Rewrite UpgradeManager implementation to suit conditions.

This commit is contained in:
Paul Chote
2016-11-19 16:18:06 +00:00
parent 05187f5828
commit 3f0b33992c
17 changed files with 219 additions and 160 deletions

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public override object Create(ActorInitializer init) { return new Targetable(init.Self, this); }
}
public class Targetable : UpgradableTrait<TargetableInfo>, ITargetable, INotifyCreated
public class Targetable : UpgradableTrait<TargetableInfo>, ITargetable
{
protected static readonly string[] None = new string[] { };
protected Cloak[] cloaks;
@@ -35,9 +35,11 @@ namespace OpenRA.Mods.Common.Traits
public Targetable(Actor self, TargetableInfo info)
: base(info) { }
void INotifyCreated.Created(Actor self)
protected override void Created(Actor self)
{
cloaks = self.TraitsImplementing<Cloak>().ToArray();
base.Created(self);
}
public virtual bool TargetableBy(Actor self, Actor viewer)