heli flight sortof ok

This commit is contained in:
Chris Forbes
2009-11-23 21:05:51 +13:00
parent c7e95c71b2
commit 7ccb2aa9ee
8 changed files with 112 additions and 29 deletions

View File

@@ -373,13 +373,22 @@ namespace OpenRa.Game
return;
unit = new Actor(name, (1 / 24f * producer.CenterLocation).ToInt2(), player);
var mobile = unit.traits.Get<Mobile>();
mobile.facing = 128;
var rp = producer.traits.GetOrDefault<RallyPoint>();
var dest = rp != null ? rp.rallyPoint : (unit.Location + new int2(0, 3));
mobile.QueueActivity(new Traits.Activities.Move(dest, 1));
var mobile = unit.traits.GetOrDefault<Mobile>();
if (mobile != null)
{
mobile.facing = 128;
mobile.QueueActivity(new Traits.Activities.Move(dest, 1));
}
var heli = unit.traits.GetOrDefault<Helicopter>();
if (heli != null)
{
heli.facing = 20;
heli.targetLocation = dest;
}
}
world.Add(unit);