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
This commit is contained in:
Bob
2009-10-24 17:28:51 +13:00
parent 979bb74bba
commit 06e6d50735
5 changed files with 255 additions and 171 deletions

View File

@@ -18,12 +18,12 @@ namespace OpenRa.Game
{
this.Unit = unit;
this.Destination = destination;
}
string GetVoiceSuffix()
{
var suffixes = new[] { ".r01", ".r03" };
return suffixes[Unit.traits.Get<Traits.Mobile>().Voice];
}
string GetVoiceSuffix()
{
var suffixes = new[] { ".r01", ".r03" };
return suffixes[Unit.traits.Get<Traits.Mobile>().Voice];
}
public override void Apply( bool leftMouseButton )
@@ -31,31 +31,9 @@ namespace OpenRa.Game
if (leftMouseButton) return;
if (Game.LocalPlayer == Unit.Owner)
Game.PlaySound(Game.SovietVoices.First.GetNext() + GetVoiceSuffix(), false);
Game.PlaySound("ackno.r00", false);
var mobile = Unit.traits.Get<Traits.Mobile>();
mobile.destination = Destination;
mobile.desiredFacing = null;
}
}
class DeployMcvOrder : Order
{
Actor Unit;
int2 Location;
public DeployMcvOrder( Actor unit, int2 location )
{
Unit = unit;
Location = location;
}
public override void Apply( bool leftMouseButton )
{
if (leftMouseButton) return;
Unit.traits.Get<Traits.McvDeploy>().DeployLocation = Location;
var mobile = Unit.traits.Get<Traits.Mobile>();
mobile.destination = mobile.toCell;
mobile.SetNextAction( new Traits.Mobile.MoveTo( Destination ) );
}
}
}