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

@@ -34,7 +34,7 @@ namespace OpenRA.Traits
for (int j = 0; j < world.Map.MapSize.Y; j++)
influence[ i, j ] = new List<Actor>();
world.ActorRemoved += a => Remove( a, a.traits.GetOrDefault<IOccupySpace>() );
world.ActorRemoved += a => Remove( a, a.TraitOrDefault<IOccupySpace>() );
}
public void Tick( Actor self )
@@ -49,7 +49,7 @@ namespace OpenRA.Traits
for( int y = 0 ; y < self.World.Map.MapSize.Y ; y++ )
if( influence[ x, y ] != null )
foreach (var a in influence[ x, y ])
if (!a.traits.Get<IOccupySpace>().OccupiedCells().Contains( new int2( x, y ) ) )
if (!a.Trait<IOccupySpace>().OccupiedCells().Contains( new int2( x, y ) ) )
throw new InvalidOperationException( "UIM: Sanity check failed A" );
foreach( var t in self.World.Queries.WithTraitMultiple<IOccupySpace>() )