public ShipInventoryManager(Game1 Game_) { Game = Game_; spriteSheet = new Sprite(Game.Content.Load <Texture2D>("Vertical-Sprites/shooterSheet")); emptyItem = new EmptyItem(Game); }
public static void UpdateLists(EmptyItem emptyItem) { inventorySize = StatsManager.InventorySlots; if (shipItems.Count > inventorySize) { int countRef = shipItems.Count; for (int n = inventorySize; n < countRef; n++) { shipItems.RemoveAt(inventorySize); } } ownedPrimaryWeapons.Clear(); ownedSecondary.Clear(); ownedPlatings.Clear(); ownedEnergyCells.Clear(); ownedShields.Clear(); int itemCounter = 0; foreach (Item item in shipItems) { switch (item.Kind) { case "Primary": { ownedPrimaryWeapons.Add((PlayerWeapon)item); itemCounter += 1; break; } case "Secondary": { ownedSecondary.Add((PlayerWeapon)item); itemCounter += 1; break; } case "Plating": { ownedPlatings.Add((PlayerPlating)item); itemCounter += 1; break; } case "EnergyCell": { ownedEnergyCells.Add((PlayerEnergyCell)item); itemCounter += 1; break; } case "Shield": { ownedShields.Add((PlayerShield)item); itemCounter += 1; break; } } } itemCount = itemCounter; if (shipItems.Count < inventorySize) { for (int n = shipItems.Count; n < inventorySize; n++) { shipItems.Add(emptyItem); } } else if (shipItems.Count > inventorySize) { for (int n = shipItems.Count; n > inventorySize; n--) { shipItems.RemoveAt(shipItems.Count - 1); } } ownCounts.Clear(); ownCounts.Add(ownedEnergyCells.Count); ownCounts.Add(ownedPlatings.Count); ownCounts.Add(ownedShields.Count); ownCounts.Add(ownedSecondary.Count); ownCounts.Add(ownedPrimaryWeapons.Count); }