Merge fail...
This commit is contained in:
@@ -6,24 +6,24 @@ using OpenRa.Game.GameRules;
|
||||
|
||||
namespace OpenRa.Game.Traits.Activities
|
||||
{
|
||||
class Teleport : IActivity
|
||||
{
|
||||
public IActivity NextActivity { get; set; }
|
||||
class Teleport : IActivity
|
||||
{
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
int2 destination;
|
||||
int2 destination;
|
||||
|
||||
public Teleport(int2 destination)
|
||||
{
|
||||
this.destination = destination;
|
||||
}
|
||||
public Teleport(int2 destination)
|
||||
{
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
var mobile = self.traits.Get<Mobile>();
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
var mobile = self.traits.Get<Mobile>();
|
||||
mobile.TeleportTo(self, destination);
|
||||
return NextActivity;
|
||||
}
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
public void Cancel(Actor self) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,20 +6,22 @@ using System.Drawing;
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class ChronoshiftDeploy : IOrder, ISpeedModifier, ITick, IPips, IPaletteModifier
|
||||
{
|
||||
public ChronoshiftDeploy(Actor self) { }
|
||||
// Recharge logic
|
||||
int remainingChargeTime = 0; // How long until we can chronoshift again?
|
||||
int chargeTime = (int)(Rules.Aftermath.ChronoTankDuration * 60 * 25); // How long between shifts?
|
||||
{
|
||||
// Recharge logic
|
||||
int chargeTick = 0; // How long until we can chronoshift again?
|
||||
int chargeLength = (int)(Rules.Aftermath.ChronoTankDuration * 60 * 25); // How long between shifts?
|
||||
|
||||
// Screen fade logic
|
||||
int animationTick = 0;
|
||||
int animationLength = 10;
|
||||
bool animationStarted = false;
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (remainingChargeTime > 0)
|
||||
remainingChargeTime--;
|
||||
|
||||
public ChronoshiftDeploy(Actor self) { }
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (chargeTick > 0)
|
||||
chargeTick--;
|
||||
|
||||
if (animationStarted)
|
||||
{
|
||||
@@ -32,45 +34,42 @@ namespace OpenRa.Game.Traits
|
||||
{
|
||||
if (animationTick > 0)
|
||||
animationTick--;
|
||||
//else
|
||||
// animationForwards = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||
{
|
||||
if (mi.Button == MouseButton.Left) return null;
|
||||
|
||||
else if (xy == self.Location && remainingChargeTime <= 0)
|
||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||
{
|
||||
if (mi.Button == MouseButton.Right && xy == self.Location && chargeTick <= 0)
|
||||
return new Order("Deploy", self, null, int2.Zero, null);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "Deploy" && remainingChargeTime <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "Deploy")
|
||||
{
|
||||
Game.controller.orderGenerator = new TeleportOrderGenerator(self);
|
||||
self.CancelActivity();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var movement = self.traits.WithInterface<IMovement>().FirstOrDefault();
|
||||
if (order.OrderString == "Chronoshift" && movement.CanEnterCell(order.TargetLocation))
|
||||
{
|
||||
{
|
||||
Game.controller.CancelInputMode();
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new Activities.Teleport(order.TargetLocation));
|
||||
Sound.Play("chrotnk1.aud");
|
||||
remainingChargeTime = chargeTime;
|
||||
animationStarted = true;
|
||||
}
|
||||
}
|
||||
|
||||
public float GetSpeedModifier()
|
||||
{
|
||||
return (Game.controller.orderGenerator is TeleportOrderGenerator) ? 0f : 1f;
|
||||
}
|
||||
self.QueueActivity(new Activities.Teleport(order.TargetLocation));
|
||||
Sound.Play("chrotnk1.aud");
|
||||
chargeTick = chargeLength;
|
||||
animationStarted = true;
|
||||
}
|
||||
}
|
||||
|
||||
public float GetSpeedModifier()
|
||||
{
|
||||
// ARGH! You must not do this, it will desync!
|
||||
return (Game.controller.orderGenerator is TeleportOrderGenerator) ? 0f : 1f;
|
||||
}
|
||||
|
||||
// Display 5 pips indicating the current charge status
|
||||
public IEnumerable<PipType> GetPips()
|
||||
@@ -78,7 +77,7 @@ namespace OpenRa.Game.Traits
|
||||
const int numPips = 5;
|
||||
for (int i = 0; i < numPips; i++)
|
||||
{
|
||||
if ((1 - remainingChargeTime * 1.0f / chargeTime) * numPips < i + 1)
|
||||
if ((1 - chargeTick * 1.0f / chargeLength) * numPips < i + 1)
|
||||
{
|
||||
yield return PipType.Transparent;
|
||||
continue;
|
||||
@@ -146,5 +145,5 @@ namespace OpenRa.Game.Traits
|
||||
bmp.SetPixel(i, j, Color.FromArgb(alpha, (int)(rgb[0] * 255), (int)(rgb[1] * 255), (int)(rgb[2] * 255)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,16 +12,16 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
public void Attacking(Actor self)
|
||||
{
|
||||
if (remainingUncloakTime <= 0)
|
||||
if (remainingUncloakTime <= 0)
|
||||
OnCloak();
|
||||
|
||||
remainingUncloakTime = (int)(Rules.General.SubmergeDelay * 60 * 25);
|
||||
remainingUncloakTime = (int)(Rules.General.SubmergeDelay * 60 * 25);
|
||||
}
|
||||
|
||||
public IEnumerable<Renderable>
|
||||
ModifyRender(Actor self, IEnumerable<Renderable> rs)
|
||||
{
|
||||
if (remainingUncloakTime > 0)
|
||||
if (remainingUncloakTime > 0)
|
||||
return rs;
|
||||
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
@@ -32,8 +32,8 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (remainingUncloakTime > 0)
|
||||
if (--remainingUncloakTime <= 0)
|
||||
if (remainingUncloakTime > 0)
|
||||
if (--remainingUncloakTime <= 0)
|
||||
OnUncloak();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class Submarine : IRenderModifier, INotifyAttack, ITick, INotifyDamage
|
||||
{
|
||||
int remainingSurfaceTime = 2; /* setup for initial dive */
|
||||
class Submarine : IRenderModifier, INotifyAttack, ITick, INotifyDamage
|
||||
{
|
||||
int remainingSurfaceTime = 2; /* setup for initial dive */
|
||||
|
||||
public Submarine(Actor self) { }
|
||||
public Submarine(Actor self) { }
|
||||
|
||||
void DoSurface()
|
||||
{
|
||||
@@ -18,36 +18,36 @@ namespace OpenRa.Game.Traits
|
||||
remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 * 25);
|
||||
}
|
||||
|
||||
public void Attacking(Actor self) { DoSurface(); }
|
||||
public void Attacking(Actor self) { DoSurface(); }
|
||||
public void Damaged(Actor self, AttackInfo e) { DoSurface(); }
|
||||
|
||||
public IEnumerable<Renderable>
|
||||
ModifyRender(Actor self, IEnumerable<Renderable> rs)
|
||||
{
|
||||
if (remainingSurfaceTime > 0)
|
||||
return rs;
|
||||
public IEnumerable<Renderable>
|
||||
ModifyRender(Actor self, IEnumerable<Renderable> rs)
|
||||
{
|
||||
if (remainingSurfaceTime > 0)
|
||||
return rs;
|
||||
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
return rs.Select(a => a.WithPalette(PaletteType.Shadow));
|
||||
else
|
||||
return new Renderable[] { };
|
||||
}
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (remainingSurfaceTime > 0)
|
||||
if (--remainingSurfaceTime <= 0)
|
||||
OnDive();
|
||||
}
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (remainingSurfaceTime > 0)
|
||||
if (--remainingSurfaceTime <= 0)
|
||||
OnDive();
|
||||
}
|
||||
|
||||
void OnSurface()
|
||||
{
|
||||
Sound.Play("subshow1.aud");
|
||||
}
|
||||
void OnSurface()
|
||||
{
|
||||
Sound.Play("subshow1.aud");
|
||||
}
|
||||
|
||||
void OnDive()
|
||||
{
|
||||
Sound.Play("subshow1.aud"); /* is this the right sound?? */
|
||||
}
|
||||
void OnDive()
|
||||
{
|
||||
Sound.Play("subshow1.aud"); /* is this the right sound?? */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user