Add ITargetableInfo interface for querying target types.
This commit is contained in:
@@ -204,6 +204,11 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
public interface IBodyOrientationInfo {}
|
public interface IBodyOrientationInfo {}
|
||||||
|
|
||||||
|
public interface ITargetableInfo
|
||||||
|
{
|
||||||
|
string[] GetTargetTypes();
|
||||||
|
}
|
||||||
|
|
||||||
public interface ITargetable
|
public interface ITargetable
|
||||||
{
|
{
|
||||||
string[] TargetTypes { get; }
|
string[] TargetTypes { get; }
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
public class TargetableBuildingInfo : ITraitInfo, Requires<BuildingInfo>
|
public class TargetableBuildingInfo : ITraitInfo, ITargetableInfo, Requires<BuildingInfo>
|
||||||
{
|
{
|
||||||
public readonly string[] TargetTypes = { };
|
public readonly string[] TargetTypes = { };
|
||||||
|
|
||||||
|
public string[] GetTargetTypes() { return TargetTypes; }
|
||||||
public object Create(ActorInitializer init) { return new TargetableBuilding(init.self, this); }
|
public object Create(ActorInitializer init) { return new TargetableBuilding(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
public class TargetableUnitInfo : ITraitInfo
|
public class TargetableUnitInfo : ITraitInfo, ITargetableInfo
|
||||||
{
|
{
|
||||||
public readonly string[] TargetTypes = { };
|
public readonly string[] TargetTypes = { };
|
||||||
|
|
||||||
|
public string[] GetTargetTypes() { return TargetTypes; }
|
||||||
public virtual object Create(ActorInitializer init) { return new TargetableUnit(init.self, this); }
|
public virtual object Create(ActorInitializer init) { return new TargetableUnit(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user