revamp of damage notifs; added Explodes

This commit is contained in:
Chris Forbes
2009-12-19 10:42:35 +13:00
parent 10431a5038
commit 07b5b4c164
16 changed files with 128 additions and 60 deletions

View File

@@ -5,7 +5,7 @@ using OpenRa.Game.GameRules;
namespace OpenRa.Game.Traits
{
class RenderUnit : RenderSimple, INotifyDamageEx
class RenderUnit : RenderSimple, INotifyDamage
{
public RenderUnit(Actor self)
: base(self)
@@ -33,24 +33,20 @@ namespace OpenRa.Game.Traits
}
bool isSmoking;
DamageState currentDs;
Animation smoke;
public void Damaged(Actor self, DamageState ds) { currentDs = ds; }
public void Damaged(Actor self, int damage, WarheadInfo warhead)
public void Damaged(Actor self, AttackInfo e)
{
if (currentDs != DamageState.Half) return;
if (!isSmoking)
{
isSmoking = true;
smoke.PlayThen("idle",
() => smoke.PlayThen("loop",
() => smoke.PlayBackwardsThen("end",
() => isSmoking = false)));
}
}
if (e.DamageState != DamageState.Half) return;
if (isSmoking) return;
isSmoking = true;
smoke.PlayThen("idle",
() => smoke.PlayThen("loop",
() => smoke.PlayBackwardsThen("end",
() => isSmoking = false)));
}
public override void Tick(Actor self)
{
base.Tick(self);