Ditto for RallyPoint.

This commit is contained in:
Paul Chote
2013-02-24 14:37:28 +13:00
parent 43159a0e05
commit 5a4bd14835
2 changed files with 9 additions and 9 deletions

View File

@@ -20,15 +20,15 @@ namespace OpenRA.Mods.RA.Effects
{
readonly Actor building;
readonly RA.RallyPoint rp;
readonly RenderSimple rs;
readonly string palettePrefix;
public Animation flag = new Animation("rallypoint");
public Animation circles = new Animation("rallypoint");
public RallyPoint(Actor building)
public RallyPoint(Actor building, string palettePrefix)
{
this.building = building;
rp = building.Trait<RA.RallyPoint>();
rs = building.Trait<RenderSimple>();
this.palettePrefix = palettePrefix;
flag.PlayRepeating("flag");
circles.Play("circles");
}
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA.Effects
&& building.World.Selection.Actors.Contains(building))
{
var pos = Traits.Util.CenterOfCell(rp.rallyPoint);
var palette = rs.Palette(building.Owner, wr);
var palette = wr.Palette(palettePrefix+building.Owner.InternalName);
yield return new Renderable(circles.Image,
pos.ToFloat2() - .5f * circles.Image.size,

View File

@@ -14,11 +14,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class RallyPointInfo : ITraitInfo, Requires<RenderSimpleInfo>
public class RallyPointInfo : ITraitInfo
{
public readonly int[] RallyPoint = { 1, 3 };
public readonly string IndicatorPalettePrefix = "player";
public object Create(ActorInitializer init) { return new RallyPoint(init.self); }
public object Create(ActorInitializer init) { return new RallyPoint(init.self, this); }
}
public class RallyPoint : IIssueOrder, IResolveOrder, ISync
@@ -26,11 +27,10 @@ namespace OpenRA.Mods.RA
[Sync] public CPos rallyPoint;
public int nearEnough = 1;
public RallyPoint(Actor self)
public RallyPoint(Actor self, RallyPointInfo info)
{
var info = self.Info.Traits.Get<RallyPointInfo>();
rallyPoint = self.Location + new CVec(info.RallyPoint[0], info.RallyPoint[1]);
self.World.AddFrameEndTask(w => w.Add(new Effects.RallyPoint(self)));
self.World.AddFrameEndTask(w => w.Add(new Effects.RallyPoint(self, info.IndicatorPalettePrefix)));
}
public IEnumerable<IOrderTargeter> Orders