public override void Initialize()
        {
            _menuWidth = _vp.Width * 0.8f;
            _menuHeight = _vp.Height * 0.3f;
            _margin = _menuWidth/24f;
            MenuItemWidth = (int)(_gameplayScreen.VP.Width * 0.06);
            MenuItemHeight = (int)(_gameplayScreen.VP.Height * 0.1);
            _position = new Vector2(_vp.X + _vp.Width * 0.1f, _vp.Y + _vp.Height * 0.6f);
            _backgroundRectangle = new Rectangle((int)_position.X, (int)_position.Y, (int)_menuWidth, (int)_menuHeight);
            _gradientTexture = ImageManager.GradientTexture;
            _transitionAlpha = 0.5f;
            _items = new List<BuildStructureMenuItem>();
            _dropArea = new Rectangle();
            BuildStructureMenuItem a = new BuildStructureMenuItem(ImageManager.GunTowerTexture, "Gun Tower", 5);
            _items.Add(a);
            BuildStructureMenuItem b = new BuildStructureMenuItem(ImageManager.LaserTowerTexture, "Laser Tower", 10);
            _items.Add(b);
            BuildStructureMenuItem c = new BuildStructureMenuItem(ImageManager.HealTowerTexture, "Heal Tower", 15);
            _items.Add(c);

            for (int i = 0; i < _items.Count; i++)
            {
                _items[i].PositionInMenu(new Rectangle((int)(_position.X + MenuSlotWidth * i), (int)(_position.Y+_margin),
                                                       (int)MenuItemWidth, (int)MenuItemHeight));
            }
            _selectedItem = null;
            base.Initialize();
        }
 public static void HandleBuildMenuSelection(Point screenInputTouchPosition, GestureSample gest)
 {
     //try
     //{
         if (_selectedItem == null && IsActive)
         {
             foreach (var menuItem in
                 Items.Where(menuItem => menuItem.Body.Contains(screenInputTouchPosition)).
                     Where(
                         menuItem => menuItem.Cost <= Player.resources))
             {
                 _selectedItem = menuItem;
                 IsActive = false;
             }
         }
         else if (_selectedItem != null)
         {
             _selectedItem.Center = gest.Position;
         }
       //  }
     //catch (Exception e)
     //{
       //  Debug.WriteLine("Problem at build menu selection" + e.Message);
     //}
 }
        public static void TryPlaceDefensiveStructure()
        {
            if (_selectedItem != null && !IsActive)
            {
                if (CheckBuildArea())
                {
                    Vector2 placePosition = new Vector2(_dropArea.Center.X, _dropArea.Center.Y) + GameplayScreen.Camera.Position;
                    DefensiveStructure tower;
                    switch (_selectedItem.Identifier)
                    {
                        case ("Gun Tower"):
                            tower = new GunTower(_gameplayScreen) { Center = placePosition };
                            break;
                        case ("Laser Tower"):
                            tower = new LaserTower(_gameplayScreen) { Center = placePosition };
                            break;
                        case ("Heal Tower"):
                            tower = new HealTower(_gameplayScreen) { Center = placePosition };
                            break;
                        default:
                            tower = null;
                            break;

                    }
                    if (tower != null)
                    {
                        tower.Initialize();
                        PlayerManager.PlayerCharacters.Add(tower);
                        Player.resources -= _selectedItem.Cost;
                    }
                }
                _selectedItem.Center = _selectedItem.MenuPositionCenter;
                _selectedItem = null;
                IsActive = false;
            }
        }