From 7668e0a30cfd4ae3176ed394eb11ebd032f9b781 Mon Sep 17 00:00:00 2001 From: Pavel Penev Date: Fri, 21 Aug 2015 18:39:09 +0300 Subject: [PATCH] Add deploy and undeploy sounds to DeployToUpgrade --- .../Traits/Upgrades/DeployToUpgrade.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs b/OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs index 7aa3c1e42e..b5d0821d2e 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs @@ -40,6 +40,12 @@ namespace OpenRA.Mods.Common.Traits [Desc("Facing that the actor must face before deploying. Set to -1 to deploy regardless of facing.")] public readonly int Facing = -1; + [Desc("Sound to play when deploying.")] + public readonly string DeploySound = null; + + [Desc("Sound to play when undeploying.")] + public readonly string UndeploySound = null; + public object Create(ActorInitializer init) { return new DeployToUpgrade(init.Self, this); } } @@ -91,6 +97,9 @@ namespace OpenRA.Mods.Common.Traits // Play undeploy animation and after that revoke the upgrades self.QueueActivity(new CallFunc(() => { + if (!string.IsNullOrEmpty(info.UndeploySound)) + Sound.Play(info.UndeploySound, self.CenterPosition); + if (string.IsNullOrEmpty(info.DeployAnimation)) { RevokeUpgrades(); @@ -114,9 +123,12 @@ namespace OpenRA.Mods.Common.Traits // Grant the upgrade self.QueueActivity(new CallFunc(GrantUpgrades)); - // Play deploy animation + // Play deploy sound and animation self.QueueActivity(new CallFunc(() => { + if (!string.IsNullOrEmpty(info.DeploySound)) + Sound.Play(info.DeploySound, self.CenterPosition); + if (string.IsNullOrEmpty(info.DeployAnimation)) return;