//add items to shop public void InitializeItems(Game game) { float xVal = 1; float yVal = 1; int width = 100; int height = 45; string[] itemNames = { "Vaccine", "Axe", "Vaccine", "Vaccine", "Vaccine", "Vaccine", "Vaccine", "Vaccine", "Vaccine", "Vaccine" }; int[] itemPrices = { 10, 100, 10, 10, 10, 10, 10, 10, 10, 10 }; string[] itemImgPaths = { @"GUITiles/vaccineInventory", @"GUITiles/axeInventory", @"GUITiles/vaccineInventory", @"GUITiles/vaccineInventory", @"GUITiles/vaccineInventory", @"GUITiles/vaccineInventory", @"GUITiles/vaccineInventory", @"GUITiles/vaccineInventory", @"GUITiles/vaccineInventory", @"GUITiles/vaccineInventory" }; for (int i = 0; i < itemNames.Length; i++) { Rectangle shopItemRect = new Rectangle((int)(base.BoundingRectangle.X * xVal) + 40, (int)(base.BoundingRectangle.Y * yVal) + 35, width, height); if (shopItemRect.Y > (base.BoundingRectangle.Height - height)) { yVal = 1; xVal += 0.95f; } else { yVal += 0.5f; } ShopMenuItem shopItem = new ShopMenuItem(game, myContentManager, @"GUITiles/Button", itemImgPaths[i], shopItemRect); shopItem.Price = itemPrices[i]; shopItem.ItemName = itemNames[i]; myShopMenuItems.Add(shopItem); } }
public void AddShopMenuItem(ShopMenuItem item) { myShopMenuItems.Add(item); }