Store Targetables in Actor.

This can be used to avoid several lookups for these traits, as well as allow Actor to provide specialised methods to deal with target types efficiently. This also reduces some code duplication.
This commit is contained in:
RoosterDragon
2015-10-17 00:45:40 +01:00
parent 8230be6a14
commit dcf375a412
14 changed files with 66 additions and 35 deletions

View File

@@ -59,7 +59,7 @@ namespace OpenRA.Traits
CenterPosition = self.CenterPosition;
Bounds = self.Bounds;
TargetTypes = self.TraitsImplementing<ITargetable>().Where(Exts.IsTraitEnabled).SelectMany(t => t.TargetTypes).ToHashSet();
TargetTypes = self.GetEnabledTargetTypes().ToHashSet();
UpdateVisibility();
}