Chronosphere implementation plus supporting tweaks to Order

This commit is contained in:
Paul Chote
2010-01-09 00:53:48 +13:00
parent 86b0ee8c97
commit becfd6eef3
9 changed files with 79 additions and 45 deletions

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using OpenRa.Game.Orders;
using OpenRa.Game.Traits;
namespace OpenRa.Game.SupportPowers
{
class ChronospherePower : ISupportPowerImpl
{
public void IsReadyNotification(SupportPower p) { Sound.Play("chrordy1.aud"); }
public void IsChargingNotification(SupportPower p) { Sound.Play("chrochr1.aud"); }
public void OnFireNotification(Actor target, int2 xy)
{
p.FinishActivate();
Game.controller.CancelInputMode();
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");
}
SupportPower p;
public void Activate(SupportPower p)
{
this.p = p;
Game.controller.orderGenerator = new ChronosphereSelectOrderGenerator(this);
Sound.Play("slcttgt1.aud");
}
}
}