Advertisement
uurha

Untitled

Dec 30th, 2021 (edited)
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class upgradeButtonScr : MonoBehaviour
  7. {
  8.     public List<GameObject> starPowerEmpty = new List<GameObject>();
  9.     public List<GameObject> starAmmoEmpty = new List<GameObject>();
  10.     public List<GameObject> starSpeedEmpty = new List<GameObject>();
  11.     public Sprite starFull;
  12.     private int pistolDamage;
  13.     private float pistolSpeed;
  14.     private int shotgunDamage;
  15.     private int uziDamage;
  16.     private int shotgunAmmo;
  17.     private int uziAmmo;
  18.     private float shotgunSpeed;
  19.     private float uziSpeed;
  20.     private upgradesScript upgrades;
  21.     void Start()
  22.     {
  23.         upgrades = GameObject.Find("Upgrades").GetComponent<upgradesScript>();
  24.  
  25.     }
  26.     void Update()
  27.     {
  28.         pistolDamage = upgrades.pistolDamage;
  29.         pistolSpeed = upgrades.pistolSpeed;
  30.         shotgunDamage = upgrades.shotgunDamage;
  31.         shotgunAmmo = upgrades.shotgunAmmo;
  32.         shotgunSpeed = upgrades.shotgunSpeed;
  33.         uziDamage = upgrades.uziDamage;
  34.         uziAmmo = upgrades.uziAmmo;
  35.         uziSpeed = upgrades.uziSpeed;
  36.  
  37.         if (upgrades.nowWeapon == 0)
  38.         {
  39.             Debug.Log(starPowerEmpty.Count);
  40.             Debug.Log(starSpeedEmpty.Count);
  41.             switch (pistolSpeed)
  42.             {
  43.                 case 1.25f:
  44.                     starSpeedEmpty[0].GetComponent<Image>().sprite = starFull;
  45.                     break;
  46.                 case 1.50f: starSpeedEmpty[1].GetComponent<Image>().sprite = starFull; break;
  47.                 case 1.75f: starSpeedEmpty[2].GetComponent<Image>().sprite = starFull; break;
  48.                 case 2f: starSpeedEmpty[3].GetComponent<Image>().sprite = starFull; break;
  49.                 case 2.25f: starSpeedEmpty[4].GetComponent<Image>().sprite = starFull; break;
  50.             }
  51.             switch (pistolDamage)
  52.             {
  53.                 case 50: starPowerEmpty[0].GetComponent<Image>().sprite = starFull; break;
  54.                 case 75: starPowerEmpty[1].GetComponent<Image>().sprite = starFull; break;
  55.                 case 100: starPowerEmpty[2].GetComponent<Image>().sprite = starFull; break;
  56.                 case 125: starPowerEmpty[3].GetComponent<Image>().sprite = starFull; break;
  57.                 case 150: starPowerEmpty[4].GetComponent<Image>().sprite = starFull; break;
  58.             }
  59.            
  60.         }
  61.         else if (upgrades.nowWeapon == 1)
  62.         {
  63.             switch (shotgunDamage)
  64.             {
  65.                 case 75: starPowerEmpty[0].GetComponent<Image>().sprite = starFull; break;
  66.                 case 100: starPowerEmpty[1].GetComponent<Image>().sprite = starFull; break;
  67.                 case 125: starPowerEmpty[2].GetComponent<Image>().sprite = starFull; break;
  68.                 case 150: starPowerEmpty[3].GetComponent<Image>().sprite = starFull; break;
  69.                 case 175: starPowerEmpty[4].GetComponent<Image>().sprite = starFull; break;
  70.             }
  71.             switch (shotgunAmmo)
  72.             {
  73.                 case 20: starAmmoEmpty[0].GetComponent<Image>().sprite = starFull; break;
  74.                 case 30: starAmmoEmpty[1].GetComponent<Image>().sprite = starFull; break;
  75.                 case 40: starAmmoEmpty[2].GetComponent<Image>().sprite = starFull; break;
  76.                 case 50: starAmmoEmpty[3].GetComponent<Image>().sprite = starFull; break;
  77.                 case 60: starAmmoEmpty[4].GetComponent<Image>().sprite = starFull; break;
  78.             }
  79.             switch (shotgunSpeed)
  80.             {
  81.                 case 1.25f: starSpeedEmpty[0].GetComponent<Image>().sprite = starFull; break;
  82.                 case 1.50f: starSpeedEmpty[1].GetComponent<Image>().sprite = starFull; break;
  83.                 case 1.75f: starSpeedEmpty[2].GetComponent<Image>().sprite = starFull; break;
  84.                 case 2f: starSpeedEmpty[3].GetComponent<Image>().sprite = starFull; break;
  85.                 case 2.25f: starSpeedEmpty[4].GetComponent<Image>().sprite = starFull; break;
  86.             }
  87.         }
  88.         else if (upgrades.nowWeapon == 2)
  89.         {
  90.             switch (uziDamage)
  91.             {
  92.                 case 75: starPowerEmpty[0].GetComponent<Image>().sprite = starFull; break;
  93.                 case 100: starPowerEmpty[1].GetComponent<Image>().sprite = starFull; break;
  94.                 case 125: starPowerEmpty[2].GetComponent<Image>().sprite = starFull; break;
  95.                 case 150: starPowerEmpty[3].GetComponent<Image>().sprite = starFull; break;
  96.                 case 175: starPowerEmpty[4].GetComponent<Image>().sprite = starFull; break;
  97.             }
  98.             switch (uziAmmo)
  99.             {
  100.                 case 75: starAmmoEmpty[0].GetComponent<Image>().sprite = starFull; break;
  101.                 case 100: starAmmoEmpty[1].GetComponent<Image>().sprite = starFull; break;
  102.                 case 125: starAmmoEmpty[2].GetComponent<Image>().sprite = starFull; break;
  103.                 case 150: starAmmoEmpty[3].GetComponent<Image>().sprite = starFull; break;
  104.                 case 175: starAmmoEmpty[4].GetComponent<Image>().sprite = starFull; break;
  105.             }
  106.             switch (uziSpeed)
  107.             {
  108.                 case 2.25f: starSpeedEmpty[0].GetComponent<Image>().sprite = starFull; break;
  109.                 case 2.50f: starSpeedEmpty[1].GetComponent<Image>().sprite = starFull; break;
  110.                 case 2.75f: starSpeedEmpty[2].GetComponent<Image>().sprite = starFull; break;
  111.                 case 3f: starSpeedEmpty[3].GetComponent<Image>().sprite = starFull; break;
  112.                 case 3.25f: starSpeedEmpty[4].GetComponent<Image>().sprite = starFull; break;
  113.             }
  114.         }
  115.        
  116.     }
  117. }
  118.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement