SetTargetSilently for DrawLineToTarget

This commit is contained in:
alzeih
2010-07-26 13:57:53 +12:00
parent 526bb3e042
commit 925ca2bb73
10 changed files with 89 additions and 7 deletions

View File

@@ -49,6 +49,7 @@
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
</ItemGroup>
<ItemGroup>
<Compile Include="CriticalBuildingState.cs" />

View File

@@ -9,6 +9,7 @@
#endregion
using System.Linq;
using System.Drawing;
using OpenRA.GameRules;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
@@ -62,6 +63,12 @@ namespace OpenRA.Mods.Cnc
actor.CancelActivity();
actor.QueueActivity(new Move(self.Location + exitOffset, self));
actor.QueueActivity(new Move(rp.rallyPoint, 0));
if (actor.Owner == self.World.LocalPlayer)
{
var line = actor.traits.GetOrDefault<DrawLineToTarget>();
if (line != null)
line.SetTargetSilently(actor, Target.FromCell(rp.rallyPoint), Color.Green);
}
foreach (var t in self.traits.WithInterface<INotifyProduction>())
t.UnitProduced(self, actor);

View File

@@ -8,6 +8,7 @@
*/
#endregion
using System.Drawing;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Render;
@@ -50,8 +51,17 @@ namespace OpenRA.Mods.Cnc
harv.QueueActivity( new CallFunc( () => harvester.Visible = true, false ) );
harv.QueueActivity( new Drag(endDock, startDock, 12) );
harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) );
if (harvester.LastHarvestedCell != int2.Zero)
harv.QueueActivity( new Move(harvester.LastHarvestedCell, 5) );
if (harvester.LastHarvestedCell != int2.Zero)
{
harv.QueueActivity( new Move(harvester.LastHarvestedCell, 5) );
if (harv.Owner == self.World.LocalPlayer)
self.World.AddFrameEndTask( w =>
{
var line = harv.traits.GetOrDefault<DrawLineToTarget>();
if (line != null)
line.SetTargetSilently(harv, Target.FromCell(harvester.LastHarvestedCell), Color.Green);
});
}
}
harv.QueueActivity( new Harvest() );
}) );