Add start and stop repair overlay animation support.

This commit is contained in:
Matthias Mailänder
2017-08-30 19:29:09 +02:00
committed by Paul Chote
parent 7160c8a1a9
commit 0018bf3063
6 changed files with 99 additions and 12 deletions

View File

@@ -35,6 +35,15 @@ namespace OpenRA.Mods.Common.Activities
health = self.TraitOrDefault<Health>();
}
protected override void OnFirstRun(Actor self)
{
if (host.Actor.IsDead)
return;
foreach (var depot in host.Actor.TraitsImplementing<INotifyRepair>())
depot.BeforeRepair(host.Actor, self);
}
public override Activity Tick(Actor self)
{
if (IsCanceled)
@@ -81,6 +90,7 @@ namespace OpenRA.Mods.Common.Activities
}
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.Info.FinishRepairingNotification, self.Owner.Faction.InternalName);
return NextActivity;
}
@@ -105,7 +115,7 @@ namespace OpenRA.Mods.Common.Activities
self.InflictDamage(host.Actor, new Damage(-hpToRepair));
foreach (var depot in host.Actor.TraitsImplementing<INotifyRepair>())
depot.Repairing(host.Actor, self);
depot.RepairTick(host.Actor, self);
remainingTicks = repairsUnits.Info.Interval;
}
@@ -114,5 +124,14 @@ namespace OpenRA.Mods.Common.Activities
return this;
}
protected override void OnLastRun(Actor self)
{
if (host.Actor.IsDead)
return;
foreach (var depot in host.Actor.TraitsImplementing<INotifyRepair>())
depot.AfterRepair(host.Actor, self);
}
}
}