finished TraitDictionary. Refactored permanent actor-removal.

This commit is contained in:
Bob
2010-08-15 01:14:06 +12:00
committed by Chris Forbes
parent c0d0636e08
commit 5561ac458b
14 changed files with 102 additions and 71 deletions

View File

@@ -31,8 +31,8 @@ namespace OpenRA
public Player Owner;
IActivity currentActivity;
public Group Group;
public Group Group;
internal Actor(World world, string name, TypeDictionary initDict )
{
var init = new ActorInitializer( this, initDict );
@@ -69,7 +69,7 @@ namespace OpenRA
}
public void Tick()
{
{
var wasIdle = currentActivity is Idle;
while (currentActivity != null)
{
@@ -142,7 +142,7 @@ namespace OpenRA
return new RectangleF(loc.X, loc.Y, size.X, size.Y);
}
public bool IsInWorld { get; set; }
public bool IsInWorld { get; internal set; }
public void QueueActivity( IActivity nextActivity )
{
@@ -209,7 +209,17 @@ namespace OpenRA
public void AddTrait( object trait )
{
World.traitDict.Add( this, trait );
World.traitDict.AddTrait( this, trait );
}
public void Destroy()
{
World.AddFrameEndTask( w => World.Remove( this ) );
}
~Actor()
{
World.traitDict.RemoveActor( this );
}
}
}