Sync superweapon activate animation

This commit is contained in:
Paul Chote
2010-01-09 12:28:39 +13:00
parent 51baf1f11d
commit ef8becb5de
5 changed files with 34 additions and 8 deletions

View File

@@ -154,5 +154,10 @@ namespace OpenRa.Game
{
return new Order("CancelProduction", subject.PlayerActor, null, int2.Zero, item);
}
public static Order PlayAnimation(Actor actor, string animationString)
{
return new Order("PlayAnimation", actor, null, int2.Zero, animationString);
}
}
}

View File

@@ -19,14 +19,14 @@ namespace OpenRa.Game.SupportPowers
Sound.Play("chrono2.aud");
foreach (var a in Game.world.Actors.Where(a => a.traits.Contains<ChronoshiftPaletteEffect>()))
a.traits.Get<ChronoshiftPaletteEffect>().DoChronoshift();
// Play chronosphere active anim
var chronosphere = Game.world.Actors.Where(a => a.Owner == p.Owner && a.traits.Contains<Chronosphere>()).FirstOrDefault();
if (chronosphere != null)
chronosphere.traits.Get<RenderBuilding>().PlayCustomAnim(chronosphere, "active");
Game.controller.AddOrder(Order.PlayAnimation(chronosphere, "active"));
// Trigger screen desaturate effect
foreach (var a in Game.world.Actors.Where(a => a.traits.Contains<ChronoshiftPaletteEffect>()))
a.traits.Get<ChronoshiftPaletteEffect>().DoChronoshift();
}
SupportPower p;
public void Activate(SupportPower p)

View File

@@ -29,7 +29,8 @@ namespace OpenRa.Game.SupportPowers
.Where(a => a.Owner == p.Owner && a.traits.Contains<IronCurtain>())
.FirstOrDefault();
if (ironCurtain != null)
ironCurtain.traits.Get<RenderBuilding>().PlayCustomAnim(ironCurtain, "active");
Game.controller.AddOrder(Order.PlayAnimation(ironCurtain, "active"));
}
SupportPower p;
public void Activate(SupportPower p)

View File

@@ -5,8 +5,18 @@ using System.Text;
namespace OpenRa.Game.Traits
{
class Chronosphere
class Chronosphere : IResolveOrder
{
public Chronosphere(Actor self) { }
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "PlayAnimation")
{
var rb = self.traits.Get<RenderBuilding>();
if (rb != null)
rb.PlayCustomAnim(self, order.TargetString);
}
}
}
}

View File

@@ -5,8 +5,18 @@ using System.Text;
namespace OpenRa.Game.Traits
{
class IronCurtain
class IronCurtain : IResolveOrder
{
public IronCurtain(Actor self) {}
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "PlayAnimation")
{
var rb = self.traits.Get<RenderBuilding>();
if (rb != null)
rb.PlayCustomAnim(self, order.TargetString);
}
}
}
}