more. doesn't run. may not compile

This commit is contained in:
Bob
2010-08-20 09:02:18 +12:00
committed by Chris Forbes
parent 5561ac458b
commit 739c38d3d8
4 changed files with 33 additions and 22 deletions

View File

@@ -47,27 +47,35 @@ namespace OpenRA
public bool Contains<T>( Actor actor )
{
if( actor.Destroyed )
throw new InvalidOperationException( "Attempted to get trait from destroyed object ({0})".F( actor.ToString() ) );
return ( (TraitContainer<T>)InnerGet( typeof( T ) ) ).GetMultiple( actor.ActorID ).Count() != 0;
}
public T Get<T>( Actor actor )
{
if( actor.Destroyed )
throw new InvalidOperationException( "Attempted to get trait from destroyed object ({0})".F( actor.ToString() ) );
return ( (TraitContainer<T>)InnerGet( typeof( T ) ) ).Get( actor.ActorID );
}
public T GetOrDefault<T>( Actor actor )
{
if( actor.Destroyed )
throw new InvalidOperationException( "Attempted to get trait from destroyed object ({0})".F( actor.ToString() ) );
return ( (TraitContainer<T>)InnerGet( typeof( T ) ) ).GetOrDefault( actor.ActorID );
}
public IEnumerable<T> WithInterface<T>( Actor actor )
{
if( actor.Destroyed )
throw new InvalidOperationException( "Attempted to get trait from destroyed object ({0})".F( actor.ToString() ) );
return ( (TraitContainer<T>)InnerGet( typeof( T ) ) ).GetMultiple( actor.ActorID );
}
public IEnumerable<TraitPair<T>> ActorsWithTraitMultiple<T>( World world )
{
return ( (TraitContainer<T>)InnerGet( typeof( T ) ) ).All().Where( x => x.Actor.IsInWorld );
return ( (TraitContainer<T>)InnerGet( typeof( T ) ) ).All();//.Where( x => x.Actor.IsInWorld );
}
public void RemoveActor( Actor a )