Add trait interfaces for added/removed from world.
This commit is contained in:
@@ -64,6 +64,8 @@ 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 INotifyAddedToWorld { void AddedToWorld(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); }
|
||||||
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||||
public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); }
|
public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); }
|
||||||
|
|||||||
@@ -159,6 +159,9 @@ namespace OpenRA
|
|||||||
a.IsInWorld = true;
|
a.IsInWorld = true;
|
||||||
actors.Add(a);
|
actors.Add(a);
|
||||||
ActorAdded(a);
|
ActorAdded(a);
|
||||||
|
|
||||||
|
foreach (var t in a.TraitsImplementing<INotifyAddedToWorld>())
|
||||||
|
t.AddedToWorld(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove(Actor a)
|
public void Remove(Actor a)
|
||||||
@@ -166,7 +169,9 @@ namespace OpenRA
|
|||||||
a.IsInWorld = false;
|
a.IsInWorld = false;
|
||||||
actors.Remove(a);
|
actors.Remove(a);
|
||||||
ActorRemoved(a);
|
ActorRemoved(a);
|
||||||
|
|
||||||
|
foreach (var t in a.TraitsImplementing<INotifyRemovedFromWorld>())
|
||||||
|
t.RemovedFromWorld(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(IEffect b) { effects.Add(b); }
|
public void Add(IEffect b) { effects.Add(b); }
|
||||||
|
|||||||
Reference in New Issue
Block a user