INotifyCreated
This commit is contained in:
@@ -63,6 +63,7 @@ namespace OpenRA.Traits
|
|||||||
public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); }
|
public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); }
|
||||||
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
|
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
|
||||||
public interface INotify { void Play(Player p, string notification); }
|
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 INotifyAddedToWorld { void AddedToWorld(Actor self); }
|
||||||
public interface INotifyRemovedFromWorld { void RemovedFromWorld(Actor self); }
|
public interface INotifyRemovedFromWorld { void RemovedFromWorld(Actor self); }
|
||||||
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
|
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
|
||||||
|
|||||||
@@ -188,6 +188,8 @@ namespace OpenRA
|
|||||||
public Actor CreateActor(bool addToWorld, string name, TypeDictionary initDict)
|
public Actor CreateActor(bool addToWorld, string name, TypeDictionary initDict)
|
||||||
{
|
{
|
||||||
var a = new Actor(this, name, initDict);
|
var a = new Actor(this, name, initDict);
|
||||||
|
foreach (var t in a.TraitsImplementing<INotifyCreated>())
|
||||||
|
t.Created(a);
|
||||||
if (addToWorld)
|
if (addToWorld)
|
||||||
Add(a);
|
Add(a);
|
||||||
return a;
|
return a;
|
||||||
|
|||||||
Reference in New Issue
Block a user