Files
OpenRA/OpenRa.Game/MoveOrder.cs
Bob 06e6d50735 Improvements to Mobile to support smooth movement (like real-ra does it)
- McvDeploy got simpler.
    - BUGFIX: Bullet no longer crashes when it damages a tree
2009-10-24 17:28:51 +13:00

40 lines
820 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace OpenRa.Game
{
abstract class Order
{
public abstract void Apply( bool leftMButton );
}
class MoveOrder : Order
{
public readonly Actor Unit;
public readonly int2 Destination;
public MoveOrder( Actor unit, int2 destination )
{
this.Unit = unit;
this.Destination = destination;
}
string GetVoiceSuffix()
{
var suffixes = new[] { ".r01", ".r03" };
return suffixes[Unit.traits.Get<Traits.Mobile>().Voice];
}
public override void Apply( bool leftMouseButton )
{
if (leftMouseButton) return;
if (Game.LocalPlayer == Unit.Owner)
Game.PlaySound("ackno.r00", false);
var mobile = Unit.traits.Get<Traits.Mobile>();
mobile.SetNextAction( new Traits.Mobile.MoveTo( Destination ) );
}
}
}