smart queries for World.Actors

This commit is contained in:
Bob
2010-01-31 01:27:50 +13:00
parent c012cf3c7f
commit 73c16d5d9d
23 changed files with 201 additions and 64 deletions

View File

@@ -30,8 +30,9 @@ namespace OpenRa.Traits
// Does this belong here? NO, but it's your mess.
// Get the crushable actors
foreach (var a in self.World.Actors.Where(b => b.traits.Contains<ICrushable>()))
foreach (var aa in self.World.Queries.WithTrait<ICrushable>())
{
var a = aa.Actor;
// Are there any units in the same cell that can crush this?
foreach( var ios in a.traits.WithInterface<IOccupySpace>() )
foreach( var cell in ios.OccupiedCells() )