//Lets the player choose which weapon to use private void ChooseWeapon() { if (Nr1Pressed && gameManager.HasPistol()) { activeWeapon = "Pistol"; } if (Nr2Pressed && gameManager.HasSniper()) { activeWeapon = "Sniper"; } foreach (GameObject weapon in weaponList) { if (weapon.name == activeWeapon) { weapon.SetActive(true); shootingScript.SetGun(weapon); } else { weapon.SetActive(false); } } }
public void PickUpWeapon(string weaponName) { switch (weaponName) { case "PistolPickup": pistolPickedUp = true; shootingScript.SetGun(pistol); playerControllerScript.AddWeapon(pistol); break; case "SniperPickup": sniperPickedUp = true; shootingScript.SetGun(sniper); playerControllerScript.AddWeapon(sniper); break; } }