SetTargetSilently for DrawLineToTarget
This commit is contained in:
@@ -38,6 +38,12 @@ namespace OpenRA.Traits
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
public void SetTargetSilently(Actor self, Target target, Color c)
|
||||
{
|
||||
this.target = target;
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
public void Render (Actor self)
|
||||
{
|
||||
var force = Game.controller.GetModifiers().HasModifier(Modifiers.Alt);
|
||||
|
||||
@@ -286,6 +286,13 @@ namespace OpenRA.Traits
|
||||
if (moveTo.HasValue)
|
||||
{
|
||||
self.CancelActivity();
|
||||
if (self.Owner == self.World.LocalPlayer)
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
var line = self.traits.GetOrDefault<DrawLineToTarget>();
|
||||
if (line != null)
|
||||
line.SetTargetSilently(self, Target.FromCell(moveTo.Value), Color.Green);
|
||||
});
|
||||
self.QueueActivity(new Move(moveTo.Value, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
@@ -63,11 +64,28 @@ namespace OpenRA.Traits
|
||||
var mobile = newUnit.traits.GetOrDefault<Mobile>();
|
||||
if (mobile != null)
|
||||
{
|
||||
int2? target = null;
|
||||
if (pi.ExitOffset != null)
|
||||
newUnit.QueueActivity(new Activities.Move(ExitLocation(self, producee).Value, 1));
|
||||
{
|
||||
target = ExitLocation(self, producee).Value;
|
||||
newUnit.QueueActivity(new Activities.Move(target.Value, 1));
|
||||
}
|
||||
|
||||
if (rp != null)
|
||||
newUnit.QueueActivity(new Activities.Move(rp.rallyPoint, 1));
|
||||
{
|
||||
target = rp.rallyPoint;
|
||||
newUnit.QueueActivity(new Activities.Move(target.Value, 1));
|
||||
}
|
||||
|
||||
if (target != null && newUnit.Owner == self.World.LocalPlayer)
|
||||
{
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
var line = newUnit.traits.GetOrDefault<DrawLineToTarget>();
|
||||
if (line != null)
|
||||
line.SetTargetSilently(newUnit, Target.FromCell(target.Value), Color.Green);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user