// method that toggles between a red and white button color for the shooting button.
public void toggleMainGun()
{
// toggle main gun weapon value
canUseMainGun = (canUseMainGun == 1) ? 0 : 1;
mainGunButton.GetComponent<UIButton>().defaultColor = (canUseMainGun == 1) ? Color.white : Color.red;
// set the playerprefs so the value is saved between game states.
PlayerPrefs.SetInt("UseMainGun", canUseMainGun);
}