Chronosphere implementation plus supporting tweaks to Order
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using OpenRa.Game.Traits;
|
||||
using OpenRa.Game.SupportPowers;
|
||||
|
||||
namespace OpenRa.Game.Orders
|
||||
{
|
||||
class ChronoshiftDestinationOrderGenerator : IOrderGenerator
|
||||
{
|
||||
public readonly Actor self;
|
||||
|
||||
public ChronoshiftDestinationOrderGenerator(Actor self)
|
||||
ISupportPowerImpl chronospherePower;
|
||||
public ChronoshiftDestinationOrderGenerator(Actor self, ISupportPowerImpl chronospherePower)
|
||||
{
|
||||
this.self = self;
|
||||
this.chronospherePower = chronospherePower;
|
||||
}
|
||||
|
||||
public IEnumerable<Order> Order(int2 xy, MouseInput mi)
|
||||
@@ -23,8 +24,7 @@ namespace OpenRa.Game.Orders
|
||||
Game.controller.CancelInputMode();
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return new Order("Chronoshift", self, null, xy, null);
|
||||
yield return new Order("Chronoshift", self, null, xy, null, chronospherePower);
|
||||
}
|
||||
|
||||
public void Tick() {}
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Game.GameRules;
|
||||
using OpenRa.Game.Traits;
|
||||
using OpenRa.Game.SupportPowers;
|
||||
|
||||
namespace OpenRa.Game.Orders
|
||||
{
|
||||
class ChronosphereSelectOrderGenerator : IOrderGenerator
|
||||
{
|
||||
ISupportPowerImpl chronospherePower;
|
||||
public ChronosphereSelectOrderGenerator(ISupportPowerImpl chronospherePower)
|
||||
{
|
||||
this.chronospherePower = chronospherePower;
|
||||
}
|
||||
|
||||
public IEnumerable<Order> Order(int2 xy, MouseInput mi)
|
||||
{
|
||||
if (mi.Button == MouseButton.Right)
|
||||
@@ -31,7 +37,7 @@ namespace OpenRa.Game.Orders
|
||||
|
||||
if (unit != null)
|
||||
{
|
||||
yield return new Order("ChronosphereSelect", underCursor, null, int2.Zero, null);
|
||||
yield return new Order("ChronosphereSelect", underCursor, null, int2.Zero, null, chronospherePower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Game.GameRules;
|
||||
using OpenRa.Game.Traits;
|
||||
using OpenRa.Game.SupportPowers;
|
||||
|
||||
namespace OpenRa.Game.Orders
|
||||
{
|
||||
class IronCurtainOrderGenerator : IOrderGenerator
|
||||
{
|
||||
ISupportPowerImpl power;
|
||||
public IronCurtainOrderGenerator(ISupportPowerImpl power)
|
||||
ISupportPowerImpl ironCurtainPower;
|
||||
public IronCurtainOrderGenerator(ISupportPowerImpl ironCurtainPower)
|
||||
{
|
||||
this.power = power;
|
||||
this.ironCurtainPower = ironCurtainPower;
|
||||
}
|
||||
|
||||
public IEnumerable<Order> Order(int2 xy, MouseInput mi)
|
||||
@@ -37,8 +37,7 @@ namespace OpenRa.Game.Orders
|
||||
|
||||
if (unit != null)
|
||||
{
|
||||
yield return new Order("IronCurtain", underCursor, this.power);
|
||||
//yield return new Order("IronCurtain", underCursor, null, int2.Zero, null);
|
||||
yield return new Order("IronCurtain", underCursor, null, int2.Zero, null, ironCurtainPower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ namespace OpenRa.Game
|
||||
public readonly string TargetString;
|
||||
public bool IsImmediate;
|
||||
|
||||
// This is a hack - fix me
|
||||
public readonly ISupportPowerImpl SupportPowerImpl;
|
||||
|
||||
public Actor Subject { get { return ActorFromUInt(SubjectId); } }
|
||||
public Actor TargetActor { get { return ActorFromUInt(TargetActorId); } }
|
||||
public Player Player { get { return Subject.Owner; } }
|
||||
@@ -21,29 +24,27 @@ namespace OpenRa.Game
|
||||
public Order(string orderString, Actor subject,
|
||||
Actor targetActor, int2 targetLocation, string targetString)
|
||||
: this( orderString, UIntFromActor( subject ),
|
||||
UIntFromActor( targetActor ), targetLocation, targetString ) {}
|
||||
UIntFromActor( targetActor ), targetLocation, targetString, null ) {}
|
||||
|
||||
public Order(string orderString, Actor subject,
|
||||
Actor targetActor, int2 targetLocation, string targetString, ISupportPowerImpl power)
|
||||
: this(orderString, UIntFromActor(subject),
|
||||
UIntFromActor(targetActor), targetLocation, targetString, power) { }
|
||||
|
||||
Order(string orderString, uint subjectId,
|
||||
uint targetActorId, int2 targetLocation, string targetString)
|
||||
: this(orderString, subjectId,
|
||||
targetActorId, targetLocation, targetString, null) { }
|
||||
|
||||
Order(string orderString, uint subjectId,
|
||||
uint targetActorId, int2 targetLocation, string targetString, ISupportPowerImpl power)
|
||||
{
|
||||
this.OrderString = orderString;
|
||||
this.SubjectId = subjectId;
|
||||
this.TargetActorId = targetActorId;
|
||||
this.TargetLocation = targetLocation;
|
||||
this.TargetString = targetString;
|
||||
}
|
||||
// This is a hack - fix me
|
||||
public readonly ISupportPowerImpl Power;
|
||||
public Order(string orderString, Actor subject, ISupportPowerImpl power)
|
||||
{
|
||||
this.OrderString = orderString;
|
||||
this.SubjectId = UIntFromActor( subject );
|
||||
|
||||
this.Power = power;
|
||||
|
||||
this.TargetActorId = UIntFromActor(null);
|
||||
this.TargetLocation = int2.Zero;
|
||||
this.TargetString = null;
|
||||
this.SupportPowerImpl = power;
|
||||
}
|
||||
|
||||
public bool Validate()
|
||||
|
||||
Reference in New Issue
Block a user