wired up 'active' anim on host building for Rearm activity
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace OpenRa.Game.Traits.Activities
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRa.Game.Traits.Activities
|
||||
{
|
||||
class Rearm : IActivity
|
||||
{
|
||||
@@ -17,6 +19,13 @@
|
||||
if (--remainingTicks == 0)
|
||||
{
|
||||
if (!limitedAmmo.GiveAmmo()) return NextActivity;
|
||||
|
||||
var hostBuilding = Game.FindUnits(self.CenterLocation, self.CenterLocation)
|
||||
.FirstOrDefault(a => a.traits.Contains<RenderBuilding>());
|
||||
|
||||
if (hostBuilding != null)
|
||||
hostBuilding.traits.Get<RenderBuilding>().PlayCustomAnim(hostBuilding, "active");
|
||||
|
||||
remainingTicks = ticksPerPip;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,12 @@ namespace OpenRa.Game.Traits
|
||||
return self.GetDamageState() == DamageState.Half ? "damaged-" : "";
|
||||
}
|
||||
|
||||
public void PlayCustomAnim(Actor self, string name)
|
||||
{
|
||||
anim.PlayThen(GetPrefix(self) + name,
|
||||
() => anim.PlayRepeating(GetPrefix(self) + "idle"));
|
||||
}
|
||||
|
||||
public virtual void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
if (!e.DamageStateChanged)
|
||||
|
||||
Reference in New Issue
Block a user