INotifyCreated

This commit is contained in:
atlimit8
2014-07-24 19:41:01 -05:00
parent 027887aa13
commit 0319b8cbda
2 changed files with 3 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ namespace OpenRA.Traits
public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); }
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
public interface INotify { void Play(Player p, string notification); }
public interface INotifyCreated { void Created(Actor self); }
public interface INotifyAddedToWorld { void AddedToWorld(Actor self); }
public interface INotifyRemovedFromWorld { void RemovedFromWorld(Actor self); }
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }

View File

@@ -188,6 +188,8 @@ namespace OpenRA
public Actor CreateActor(bool addToWorld, string name, TypeDictionary initDict)
{
var a = new Actor(this, name, initDict);
foreach (var t in a.TraitsImplementing<INotifyCreated>())
t.Created(a);
if (addToWorld)
Add(a);
return a;