Actor.traits is implementation detail

This commit is contained in:
Bob
2010-08-14 15:19:30 +12:00
committed by alzeih
parent f6c6255f64
commit ae703d50b2
165 changed files with 586 additions and 561 deletions

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Orders
{
var underCursor = world.FindUnitsAtMouse(mi.Location)
.Where(a => a.Owner == world.LocalPlayer
&& a.traits.Contains<CanPowerDown>())
&& a.HasTrait<CanPowerDown>())
.FirstOrDefault();
if (underCursor != null)

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Orders
if (mi.Button == MouseButton.Left)
{
var underCursor = world.FindUnitsAtMouse(mi.Location)
.Where(a => a.Owner == world.LocalPlayer && a.traits.Contains<RepairableBuilding>()).FirstOrDefault();
.Where(a => a.Owner == world.LocalPlayer && a.HasTrait<RepairableBuilding>()).FirstOrDefault();
if (underCursor == null)
yield break;

View File

@@ -30,8 +30,8 @@ namespace OpenRA.Mods.RA.Orders
{
var underCursor = world.FindUnitsAtMouse(mi.Location)
.Where(a => a.Owner == world.LocalPlayer
&& a.traits.Contains<Building>()
&& a.traits.Contains<Selectable>()).FirstOrDefault();
&& a.HasTrait<Building>()
&& a.HasTrait<Selectable>()).FirstOrDefault();
var building = underCursor != null ? underCursor.Info.Traits.Get<BuildingInfo>() : null;

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Orders
if (!world.LocalPlayer.Shroud.IsExplored(xy))
return "move-blocked";
var movement = self.traits.GetOrDefault<IMove>();
var movement = self.TraitOrDefault<IMove>();
return (movement.CanEnterCell(xy)) ? "chrono-target" : "move-blocked";
}
}