void UIAmmoUpdateRequest() { for (int i = 0; i < ammoBox.typesOfAmmunition.Count; i++) { if (ammoBox.typesOfAmmunition[i].ammoName == ammoName) { gunMaster.CallEventAmmoChanged(currentAmmo, ammoBox.typesOfAmmunition[i].ammoCurrentCarried); break; } } }
void PurchaseAmmunition() // BUY AMMUNITION { string ammoName = itemAvailableForPurchase.GetComponent <Item_Name>().name; if (ammoName == "Assault Rifle Ammunition") { playerMaster.GetComponent <Player_AmmoBox>().PickedUpAmmo("AR", 300 - ammoBox.typesOfAmmunition[0].ammoCurrentCarried); gunMaster.CallEventAmmoChanged(ammoBox.typesOfAmmunition[0].ammoCurrentCarried, ammoBox.typesOfAmmunition[0].ammoMaxQuantity); if (GetComponent <Player_AmmoBox>().typesOfAmmunition[0].ammoMaxQuantity >= 300) { playerMaster.CallEventPlayerEarnsPoints(500); return; } } else if (ammoName == "Submachine Gun Ammunition") { playerMaster.GetComponent <Player_AmmoBox>().PickedUpAmmo("SMG", 300 - ammoBox.typesOfAmmunition[1].ammoCurrentCarried); gunMaster.CallEventAmmoChanged(ammoBox.typesOfAmmunition[1].ammoCurrentCarried, ammoBox.typesOfAmmunition[1].ammoMaxQuantity); if (GetComponent <Player_AmmoBox>().typesOfAmmunition[1].ammoMaxQuantity >= 300) { playerMaster.CallEventPlayerEarnsPoints(500); return; } } else if (ammoName == "Sniper Rifle Ammunition") { playerMaster.GetComponent <Player_AmmoBox>().PickedUpAmmo("Sniper", 60 - ammoBox.typesOfAmmunition[2].ammoCurrentCarried); gunMaster.CallEventAmmoChanged(ammoBox.typesOfAmmunition[2].ammoCurrentCarried, ammoBox.typesOfAmmunition[2].ammoMaxQuantity); if (GetComponent <Player_AmmoBox>().typesOfAmmunition[2].ammoMaxQuantity >= 60) { playerMaster.CallEventPlayerEarnsPoints(500); return; } } }