GetEffectiveSpeed() factored out; Mobile hacked to only allow Move orders if the speed is nonzero

This commit is contained in:
Chris Forbes
2009-12-18 12:16:13 +13:00
parent 278eb7b4f7
commit f9b4782a99
5 changed files with 21 additions and 11 deletions

View File

@@ -48,12 +48,7 @@ namespace OpenRa.Game.Traits
Util.TickFacing(ref unit.Facing, desiredFacing,
self.Info.ROT);
var actualSpeed = self.traits.WithInterface<ISpeedModifier>().Aggregate(
(float)(self.Info as MobileInfo).Speed,
(a, t) => t.GetSpeedModifier() * a);
// .6f going the wrong way; .8f going sideways, 1f going forward.
var rawSpeed = .2f * actualSpeed;
var rawSpeed = .2f * Util.GetEffectiveSpeed(self);
var angle = (unit.Facing - desiredFacing) / 128f * Math.PI;
var scale = .4f + .6f * (float)Math.Cos(angle);