fixed bug where cloakable units were not targetable when uncloaked. removed ITargetable interface in favor of using the Targetable trait. fixed warnings in child classes of Targetable.

This commit is contained in:
pdovy
2010-10-10 23:09:17 -05:00
committed by Chris Forbes
parent a904047a16
commit e883e63c87
5 changed files with 18 additions and 20 deletions

View File

@@ -15,25 +15,25 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public class TargetableAircraftInfo : TargetableInfo
public class TargetableAircraftInfo : TargetableInfo, ITraitPrerequisite<AircraftInfo>
{
public readonly string[] GroundedTargetTypes = { };
public override object Create(ActorInitializer init) { return new TargetableAircraft(init.self, this); }
}
public class TargetableAircraft : ITargetable
public class TargetableAircraft : Targetable
{
TargetableAircraftInfo Info;
Aircraft Aircraft;
public TargetableAircraft(Actor self, TargetableAircraftInfo info)
: base(info)
{
Info = info;
Aircraft = self.Trait<Aircraft>();
}
public string[] TargetTypes
public override string[] TargetTypes
{
get { return (Aircraft.Altitude > 0) ? Info.TargetTypes : Info.GroundedTargetTypes; }
get { return (Aircraft.Altitude > 0) ? ((TargetableAircraftInfo)Info).TargetTypes
: ((TargetableAircraftInfo)Info).GroundedTargetTypes; }
}
}
}