Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool playerHasPoints = false;
- bool canBuyFirstSkill = false;
- bool canBuySecondSkill = false;
- bool canBuyThirdSkill = false;
- bool canBuyFourthSkill = false;
- public Button firstButton;
- public Button secondButton;
- public Button thirdButton;
- public Button fourthButton;
- public GameObject firstPurchase;
- public GameObject secondPurchase;
- public GameObject thirdPurchase;
- public GameObject fourthPurchase;
- public static int IQ = 0;
- bool buttonInteractable;
- [Header("Audio")]
- public AudioSource myFx;
- public AudioClip SkillUpgraded;
- public AudioClip cantBuySkill;
- public AudioClip hoverFx;
- public void BuySkillSound()
- {
- myFx.PlayOneShot(SkillUpgraded);
- }
- public void cantBuySkillSound()
- {
- myFx.PlayOneShot(cantBuySkill);
- }
- public void HoverSound()
- {
- myFx.PlayOneShot(hoverFx);
- }
- private void Start()
- {
- firstPurchase.SetActive(false);
- secondPurchase.SetActive(false);
- thirdPurchase.SetActive(false);
- fourthPurchase.SetActive(false);
- }
- private void Update()
- {
- if (Points.pointsValue >= 1)
- {
- playerHasPoints = true;
- buttonInteractable = true;
- }
- else if (Points.pointsValue < 1)
- {
- playerHasPoints = false;
- buttonInteractable = false;
- }
- if (playerHasPoints == true)
- {
- canBuyFirstSkill = true;
- }
- }
- public void FirstSkillPurchase()
- {
- if (playerHasPoints == true & canBuyFirstSkill == true & buttonInteractable == true)
- {
- IQ += 1;
- firstButton.interactable = false;
- Points.pointsValue -= 1;
- firstPurchase.SetActive(true);
- canBuySecondSkill = true;
- canBuyFirstSkill = false;
- BuySkillSound();
- }
- else
- {
- cantBuySkillSound();
- }
- }
- public void SecondSkillPurhchase()
- {
- if (playerHasPoints == true && canBuySecondSkill == true & buttonInteractable == true)
- {
- IQ += 1;
- secondButton.interactable = false;
- Points.pointsValue -= 1;
- secondPurchase.SetActive(true);
- canBuyThirdSkill = true;
- canBuySecondSkill = false;
- BuySkillSound();
- }
- else
- {
- cantBuySkillSound();
- }
- }
- public void ThirdSkillPurchase()
- {
- if (playerHasPoints == true && canBuyThirdSkill == true & buttonInteractable == true)
- {
- IQ += 1;
- thirdButton.interactable = false;
- Points.pointsValue -= 1;
- thirdPurchase.SetActive(true);
- canBuyFourthSkill = true;
- canBuyThirdSkill = false;
- BuySkillSound();
- }
- else
- {
- cantBuySkillSound();
- }
- }
- public void FouthSkillPurchase()
- {
- if (playerHasPoints == true && canBuyFourthSkill == true & buttonInteractable == true)
- {
- IQ += 1;
- fourthButton.interactable = false;
- Points.pointsValue -= 1;
- fourthPurchase.SetActive(true);
- canBuyFourthSkill = false;
- BuySkillSound();
- }
- else
- {
- cantBuySkillSound();
- }
- }
- public void DeactivateButtons()
- {
- if (buttonInteractable == false)
- {
- firstButton.interactable = false;
- secondButton.interactable = false;
- thirdButton.interactable = false;
- fourthButton.interactable = false;
- }
- }
- public void ResetPoints()
- {
- firstPurchase.SetActive(false);
- secondPurchase.SetActive(false);
- thirdPurchase.SetActive(false);
- fourthPurchase.SetActive(false);
- canBuyFirstSkill = true;
- canBuySecondSkill = false;
- canBuyThirdSkill = false;
- canBuyFourthSkill = false;
- firstButton.interactable = true;
- secondButton.interactable = true;
- thirdButton.interactable = true;
- fourthButton.interactable = true;
- IQ = 0;
- }
Advertisement
RAW Paste Data
Copied
Advertisement