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

@@ -6,12 +6,12 @@
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Drawing;
using OpenRA.Effects;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
#endregion
using System.Drawing;
using OpenRA.Effects;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
using OpenRA.Traits.Activities;
namespace OpenRA.Mods.RA
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA
bool CanRepair(Actor self, Actor a)
{
if (!a.traits.Contains<Building>()) return false;
if (!a.HasTrait<Building>()) return false;
return (self.Owner.Stances[a.Owner] == Stance.Ally);
}
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA
self.World.AddFrameEndTask(w =>
{
w.Add(new FlashTarget(order.TargetActor));
var line = self.traits.GetOrDefault<DrawLineToTarget>();
var line = self.TraitOrDefault<DrawLineToTarget>();
if (line != null)
line.SetTarget(self, Target.FromOrder(order), Color.Yellow);
});