added infantry taking cover behavior

This commit is contained in:
Chris Forbes
2009-12-17 21:52:39 +13:00
parent 36e788b685
commit ac2b666366
9 changed files with 184 additions and 16 deletions

View File

@@ -48,8 +48,12 @@ 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 * (self.Info as VehicleInfo).Speed;
var rawSpeed = .2f * actualSpeed;
var angle = (unit.Facing - desiredFacing) / 128f * Math.PI;
var scale = .4f + .6f * (float)Math.Cos(angle);