Merge pull request #8784 from Mailaender/heli-drop-sounds
Added helicopter takeoff and landing sound
This commit is contained in:
@@ -21,6 +21,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly Target target;
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
bool playedSound;
|
||||
|
||||
public HeliFly(Actor self, Target t)
|
||||
{
|
||||
@@ -53,6 +54,12 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
if (!playedSound && helicopter.Info.TakeoffSound != null && self.IsAtGroundLevel())
|
||||
{
|
||||
Sound.Play(helicopter.Info.TakeoffSound);
|
||||
playedSound = true;
|
||||
}
|
||||
|
||||
if (AdjustAltitude(self, helicopter, helicopter.Info.CruiseAltitude))
|
||||
return this;
|
||||
|
||||
|
||||
@@ -16,14 +16,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class HeliLand : Activity
|
||||
{
|
||||
readonly Helicopter helicopter;
|
||||
readonly WDist landAltitude;
|
||||
bool requireSpace;
|
||||
bool playedSound;
|
||||
|
||||
public HeliLand(Actor self, bool requireSpace)
|
||||
{
|
||||
this.requireSpace = requireSpace;
|
||||
helicopter = self.Trait<Helicopter>();
|
||||
landAltitude = helicopter.Info.LandAltitude;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
@@ -34,7 +33,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (requireSpace && !helicopter.CanLand(self.Location))
|
||||
return this;
|
||||
|
||||
if (HeliFly.AdjustAltitude(self, helicopter, landAltitude))
|
||||
if (!playedSound && helicopter.Info.LandingSound != null && !self.IsAtGroundLevel())
|
||||
{
|
||||
Sound.Play(helicopter.Info.LandingSound);
|
||||
playedSound = true;
|
||||
}
|
||||
|
||||
if (HeliFly.AdjustAltitude(self, helicopter, helicopter.Info.LandAltitude))
|
||||
return this;
|
||||
|
||||
return NextActivity;
|
||||
|
||||
@@ -30,6 +30,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("How fast the helicopter ascends or descends.")]
|
||||
public readonly WDist AltitudeVelocity = new WDist(43);
|
||||
|
||||
public readonly string TakeoffSound = null;
|
||||
public readonly string LandingSound = null;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Helicopter(init, this); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user