summaryrefslogtreecommitdiff
path: root/Penguloon/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon/Scenes')
-rw-r--r--Penguloon/Scenes/GameScene.cs16
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)
{