private void btnMechs_Click(Button sender) { SetUnitTypeButtonActive(sender); activeList = Active_List.Mech; spawner.SpawnUnit(MechsPriceList.Type.PriceLists[mechListIndex].PricedUnit); string name = MechsPriceList.Type.PriceLists[mechListIndex].Name; int cost = MechsPriceList.Type.PriceLists[mechListIndex].Price; txtUnitName.Text = "Name: " + name; txtUnitCost.Text = "Cost: " + cost.ToString(); bool alreadyPurchased = false; foreach (CustomizableUnit cu in MechDBUnits) { if (cu.Name == name) { alreadyPurchased = true; break; } } btnBuy.Enable = !(alreadyPurchased || cash < cost); }
private void btnMechs_Click(Button sender) { SetUnitTypeButtonActive(sender); activeList = Active_List.Mech; CustomizableUnit cu = MechDBUnits[mechListIndex]; spawner.SpawnUnit(MechsPriceList.Type.PriceLists[cu.ID].PricedUnit); UpdateVariantCost(-1); txtUnitName.Text = "Unit Name: " + cu.Name; }