Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class upgradeButtonScr : MonoBehaviour
- {
- public List<GameObject> starPowerEmpty = new List<GameObject>();
- public List<GameObject> starAmmoEmpty = new List<GameObject>();
- public List<GameObject> starSpeedEmpty = new List<GameObject>();
- public Sprite starFull;
- private int pistolDamage;
- private float pistolSpeed;
- private int shotgunDamage;
- private int uziDamage;
- private int shotgunAmmo;
- private int uziAmmo;
- private float shotgunSpeed;
- private float uziSpeed;
- private upgradesScript upgrades;
- void Start()
- {
- upgrades = GameObject.Find("Upgrades").GetComponent<upgradesScript>();
- }
- void Update()
- {
- pistolDamage = upgrades.pistolDamage;
- pistolSpeed = upgrades.pistolSpeed;
- shotgunDamage = upgrades.shotgunDamage;
- shotgunAmmo = upgrades.shotgunAmmo;
- shotgunSpeed = upgrades.shotgunSpeed;
- uziDamage = upgrades.uziDamage;
- uziAmmo = upgrades.uziAmmo;
- uziSpeed = upgrades.uziSpeed;
- if (upgrades.nowWeapon == 0)
- {
- Debug.Log(starPowerEmpty.Count);
- Debug.Log(starSpeedEmpty.Count);
- switch (pistolSpeed)
- {
- case 1.25f:
- starSpeedEmpty[0].GetComponent<Image>().sprite = starFull;
- break;
- case 1.50f: starSpeedEmpty[1].GetComponent<Image>().sprite = starFull; break;
- case 1.75f: starSpeedEmpty[2].GetComponent<Image>().sprite = starFull; break;
- case 2f: starSpeedEmpty[3].GetComponent<Image>().sprite = starFull; break;
- case 2.25f: starSpeedEmpty[4].GetComponent<Image>().sprite = starFull; break;
- }
- switch (pistolDamage)
- {
- case 50: starPowerEmpty[0].GetComponent<Image>().sprite = starFull; break;
- case 75: starPowerEmpty[1].GetComponent<Image>().sprite = starFull; break;
- case 100: starPowerEmpty[2].GetComponent<Image>().sprite = starFull; break;
- case 125: starPowerEmpty[3].GetComponent<Image>().sprite = starFull; break;
- case 150: starPowerEmpty[4].GetComponent<Image>().sprite = starFull; break;
- }
- }
- else if (upgrades.nowWeapon == 1)
- {
- switch (shotgunDamage)
- {
- case 75: starPowerEmpty[0].GetComponent<Image>().sprite = starFull; break;
- case 100: starPowerEmpty[1].GetComponent<Image>().sprite = starFull; break;
- case 125: starPowerEmpty[2].GetComponent<Image>().sprite = starFull; break;
- case 150: starPowerEmpty[3].GetComponent<Image>().sprite = starFull; break;
- case 175: starPowerEmpty[4].GetComponent<Image>().sprite = starFull; break;
- }
- switch (shotgunAmmo)
- {
- case 20: starAmmoEmpty[0].GetComponent<Image>().sprite = starFull; break;
- case 30: starAmmoEmpty[1].GetComponent<Image>().sprite = starFull; break;
- case 40: starAmmoEmpty[2].GetComponent<Image>().sprite = starFull; break;
- case 50: starAmmoEmpty[3].GetComponent<Image>().sprite = starFull; break;
- case 60: starAmmoEmpty[4].GetComponent<Image>().sprite = starFull; break;
- }
- switch (shotgunSpeed)
- {
- case 1.25f: starSpeedEmpty[0].GetComponent<Image>().sprite = starFull; break;
- case 1.50f: starSpeedEmpty[1].GetComponent<Image>().sprite = starFull; break;
- case 1.75f: starSpeedEmpty[2].GetComponent<Image>().sprite = starFull; break;
- case 2f: starSpeedEmpty[3].GetComponent<Image>().sprite = starFull; break;
- case 2.25f: starSpeedEmpty[4].GetComponent<Image>().sprite = starFull; break;
- }
- }
- else if (upgrades.nowWeapon == 2)
- {
- switch (uziDamage)
- {
- case 75: starPowerEmpty[0].GetComponent<Image>().sprite = starFull; break;
- case 100: starPowerEmpty[1].GetComponent<Image>().sprite = starFull; break;
- case 125: starPowerEmpty[2].GetComponent<Image>().sprite = starFull; break;
- case 150: starPowerEmpty[3].GetComponent<Image>().sprite = starFull; break;
- case 175: starPowerEmpty[4].GetComponent<Image>().sprite = starFull; break;
- }
- switch (uziAmmo)
- {
- case 75: starAmmoEmpty[0].GetComponent<Image>().sprite = starFull; break;
- case 100: starAmmoEmpty[1].GetComponent<Image>().sprite = starFull; break;
- case 125: starAmmoEmpty[2].GetComponent<Image>().sprite = starFull; break;
- case 150: starAmmoEmpty[3].GetComponent<Image>().sprite = starFull; break;
- case 175: starAmmoEmpty[4].GetComponent<Image>().sprite = starFull; break;
- }
- switch (uziSpeed)
- {
- case 2.25f: starSpeedEmpty[0].GetComponent<Image>().sprite = starFull; break;
- case 2.50f: starSpeedEmpty[1].GetComponent<Image>().sprite = starFull; break;
- case 2.75f: starSpeedEmpty[2].GetComponent<Image>().sprite = starFull; break;
- case 3f: starSpeedEmpty[3].GetComponent<Image>().sprite = starFull; break;
- case 3.25f: starSpeedEmpty[4].GetComponent<Image>().sprite = starFull; break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement