Added FacingInit and AltitudeInit. Used in Mobile/Aircraft/Husks. Refactored Production, SpyPlane, Paratroopers and LeavesHusk

This commit is contained in:
alzeih
2010-08-02 00:49:26 +12:00
parent 2cc6e197fa
commit 4ea66ea309
8 changed files with 83 additions and 19 deletions

View File

@@ -11,6 +11,7 @@
using OpenRA.Mods.RA.Activities;
using OpenRA.Orders;
using OpenRA.Traits;
using OpenRA.FileFormats;
namespace OpenRA.Mods.RA
{
@@ -57,13 +58,17 @@ namespace OpenRA.Mods.RA
var startPos = owner.World.ChooseRandomEdgeCell();
owner.World.AddFrameEndTask(w =>
{
var flareType = (Info as ParatroopersPowerInfo).FlareType;
var flare = flareType != null ? w.CreateActor(flareType, p, owner) : null;
var a = w.CreateActor((Info as ParatroopersPowerInfo).UnitType, startPos, owner);
a.traits.Get<IFacing>().Facing = Util.GetFacing(p - startPos, 0);
a.traits.Get<IMove>().Altitude = a.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
var info = (Info as ParatroopersPowerInfo);
var flare = info.FlareType != null ? w.CreateActor(info.FlareType, p, owner) : null;
var a = w.CreateActor(info.UnitType, new TypeDictionary
{
new LocationInit( startPos ),
new OwnerInit( owner ),
new FacingInit( Util.GetFacing(p - startPos, 0) ),
new AltitudeInit( Rules.Info[info.UnitType].Traits.Get<PlaneInfo>().CruiseAltitude ),
});
a.CancelActivity();
a.QueueActivity(new FlyCircle(p));
a.traits.Get<ParaDrop>().SetLZ(p, flare);