diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2018-01-16 14:49:40 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2018-01-16 14:49:40 +0100 |
| commit | 6996be0fc143085b6aa459f2eb7b288ac1617c0b (patch) | |
| tree | 55f5ca1e95dc52cf9a1e81a0250fb9436e5ec6a9 /Penguloon/Scenes | |
| parent | 1f5295752f9052c2b7b64660fa36293f18de73d0 (diff) | |
upgrade sounds
Diffstat (limited to 'Penguloon/Scenes')
| -rw-r--r-- | Penguloon/Scenes/GameScene.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Penguloon/Scenes/GameScene.cs b/Penguloon/Scenes/GameScene.cs index ac29989..0f65f1a 100644 --- a/Penguloon/Scenes/GameScene.cs +++ b/Penguloon/Scenes/GameScene.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework.Input.Touch; using Penguloon.Controls; using Penguloon.Levels; -using Penguloon.Scenes; using System; namespace Penguloon.Scenes @@ -253,11 +252,8 @@ namespace Penguloon.Scenes { Level.SelectedObject.UpgradeList[i].State = Objects.UpgradeState.Idle; - // continue of we cant afford this upgrade - if (Level.SelectedObject.UpgradeList[i].Cost > Level.Money) continue; - Rectangle upgradeBox = new Rectangle( - (int)StaticUIValues.ScreenViewport.X - StaticUIValues.IngameUIWidth, + (int)Level.Map.MapWidth, startY + (int)StaticUIValues.UpgradePanelSize.Y * i, (int)StaticUIValues.UpgradePanelSize.X, (int)StaticUIValues.UpgradePanelSize.Y); @@ -269,11 +265,21 @@ namespace Penguloon.Scenes { if (upgradeBox.Contains(touchLocations[x].Position.ToPoint())) { + // continue of we cant afford this upgrade + if (Level.SelectedObject.UpgradeList[i].Cost > Level.Money) + { + SoundManager.PlayUnavailableSound(); + continue; + } + Level.SelectedObject.UpgradeList[i].Click(); // pay upgrade cost Level.Money -= Level.SelectedObject.UpgradeList[i].Cost; + // play buy sound here + SoundManager.PlayUpgradeSound(); + // insert next upgrade if present if (Level.SelectedObject.UpgradeList[i].NextUgrade != null) { |
