Move INotifyDamageStateChanged to mod code and require explicit implementation

This commit is contained in:
reaperrr
2016-10-20 21:41:25 +02:00
parent 7955aeb1c3
commit 77a134da91
6 changed files with 13 additions and 5 deletions

View File

@@ -308,7 +308,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
public void DamageStateChanged(Actor self, AttackInfo e)
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
{
Do((b, d) => b.UpdateState());

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info;
}
public void DamageStateChanged(Actor self, AttackInfo e)
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
{
if (!self.IsInWorld)
return;

View File

@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Traits.Render
return RenderSprites.NormalizeSequence(DefaultAnimation, self.GetDamageState(), sequence);
}
public virtual void DamageStateChanged(Actor self, AttackInfo e)
protected virtual void DamageStateChanged(Actor self)
{
if (DefaultAnimation.CurrentSequence != null)
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
@@ -128,6 +128,11 @@ namespace OpenRA.Mods.Common.Traits.Render
DefaultAnimation.ReplaceAnim(sequence);
}
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
{
DamageStateChanged(self);
}
void INotifyBuildComplete.BuildingComplete(Actor self) { buildComplete = true; }
void INotifySold.Selling(Actor self) { buildComplete = false; }
void INotifySold.Sold(Actor self) { }

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
this.info = info;
}
public void DamageStateChanged(Actor self, AttackInfo e)
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
{
var rand = Game.CosmeticRandom;