moving Actor.Location onto the appropriate traits (bob)
This commit is contained in:
@@ -68,9 +68,10 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var speed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
var angle = unit.Facing / 128f * Math.PI;
|
||||
var aircraft = self.traits.Get<Aircraft>();
|
||||
|
||||
self.CenterLocation += speed * -float2.FromAngle((float)angle);
|
||||
self.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
aircraft.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
|
||||
unit.Altitude += Math.Sign(desiredAltitude - unit.Altitude);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return NextActivity;
|
||||
}
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var aircraft = self.traits.Get<Aircraft>();
|
||||
|
||||
var info = self.Info.Traits.Get<HelicopterInfo>();
|
||||
if (unit.Altitude != info.CruiseAltitude)
|
||||
@@ -62,7 +63,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
if (!float2.WithinEpsilon(float2.Zero, dist, range * Game.CellSize))
|
||||
self.CenterLocation += (rawSpeed / dist.Length) * dist;
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var info = self.Info.Traits.Get<HelicopterInfo>();
|
||||
var aircraft = self.traits.Get<Aircraft>();
|
||||
|
||||
if (unit.Altitude != info.CruiseAltitude)
|
||||
{
|
||||
@@ -54,7 +55,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (float2.WithinEpsilon(float2.Zero, dist, 2))
|
||||
{
|
||||
self.CenterLocation = Dest;
|
||||
self.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
aircraft.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
var rawSpeed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
self.CenterLocation += (rawSpeed / dist.Length) * dist;
|
||||
self.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
aircraft.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return NextActivity;
|
||||
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var aircraft = self.traits.Get<Aircraft>();
|
||||
|
||||
if (unit.Altitude > 0)
|
||||
--unit.Altitude;
|
||||
@@ -60,7 +61,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var angle = unit.Facing / 128f * Math.PI;
|
||||
|
||||
self.CenterLocation += speed * -float2.FromAngle((float)angle);
|
||||
self.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
aircraft.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user