Pass target line color to inner move activities.

This commit is contained in:
Paul Chote
2019-01-13 16:36:30 +00:00
parent 62102b9f77
commit b2d960ec19
32 changed files with 127 additions and 68 deletions

View File

@@ -10,6 +10,7 @@
#endregion
using System.Collections.Generic;
using System.Drawing;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
@@ -24,13 +25,13 @@ namespace OpenRA.Mods.Common.Activities
readonly WDist minRange;
bool soundPlayed;
public Fly(Actor self, Target t)
public Fly(Actor self, Target t, Color? targetLineColor = null)
{
aircraft = self.Trait<Aircraft>();
target = t;
}
public Fly(Actor self, Target t, WDist minRange, WDist maxRange)
public Fly(Actor self, Target t, WDist minRange, WDist maxRange, Color? targetLineColor = null)
: this(self, t)
{
this.maxRange = maxRange;

View File

@@ -9,6 +9,7 @@
*/
#endregion
using System.Drawing;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
@@ -17,17 +18,19 @@ namespace OpenRA.Mods.Common.Activities
{
public class FlyFollow : Activity
{
readonly Aircraft aircraft;
readonly WDist minRange;
readonly WDist maxRange;
readonly Color? targetLineColor;
Target target;
Aircraft aircraft;
WDist minRange;
WDist maxRange;
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange)
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange, Color? targetLineColor = null)
{
this.target = target;
aircraft = self.Trait<Aircraft>();
this.minRange = minRange;
this.maxRange = maxRange;
this.targetLineColor = targetLineColor;
}
public override Activity Tick(Actor self)
@@ -48,7 +51,7 @@ namespace OpenRA.Mods.Common.Activities
return this;
}
return ActivityUtils.SequenceActivities(new Fly(self, target, minRange, maxRange), this);
return ActivityUtils.SequenceActivities(new Fly(self, target, minRange, maxRange, targetLineColor: targetLineColor), this);
}
}
}

View File

@@ -10,6 +10,7 @@
#endregion
using System.Collections.Generic;
using System.Drawing;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
@@ -24,13 +25,13 @@ namespace OpenRA.Mods.Common.Activities
readonly WDist minRange;
bool soundPlayed;
public HeliFly(Actor self, Target t)
public HeliFly(Actor self, Target t, Color? targetLineColor = null)
{
aircraft = self.Trait<Aircraft>();
target = t;
}
public HeliFly(Actor self, Target t, WDist minRange, WDist maxRange)
public HeliFly(Actor self, Target t, WDist minRange, WDist maxRange, Color? targetLineColor = null)
: this(self, t)
{
this.maxRange = maxRange;

View File

@@ -10,6 +10,7 @@
#endregion
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
@@ -89,7 +90,9 @@ namespace OpenRA.Mods.Common.Activities
var target = Target.FromPos(nearestResupplier.CenterPosition + randomPosition);
return ActivityUtils.SequenceActivities(new HeliFly(self, target, WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase), this);
return ActivityUtils.SequenceActivities(
new HeliFly(self, target, WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase, targetLineColor: Color.Green),
this);
}
return this;

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
@@ -140,7 +141,7 @@ namespace OpenRA.Mods.Common.Activities
if (nearestResupplier != null)
return ActivityUtils.SequenceActivities(
new Fly(self, Target.FromActor(nearestResupplier), WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase),
new Fly(self, Target.FromActor(nearestResupplier), WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase, targetLineColor: Color.Green),
new FlyCircle(self, aircraft.Info.NumberOfTicksToVerifyAvailableAirport),
this);
else