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 upgradesScript : MonoBehaviour
- {
- public static upgradesScript instance;
- public GameObject pistol;
- public GameObject shotgun;
- public GameObject uzi;
- public int nowWeapon;
- public Text nowWeaponText;
- // weapons upgrades
- public int pistolDamage;
- public int shotgunDamage;
- public int uziDamage;
- public int shotgunAmmo;
- public int uziAmmo;
- public float pistolSpeed;
- public float shotgunSpeed;
- public float uziSpeed;
- public GameObject PistolUI;
- public GameObject shotgunUI;
- public GameObject uziUI;
- void Start()
- {
- nowWeapon = 0;
- }
- // Update is called once per frame
- void Update()
- {
- switch (nowWeapon)
- {
- case 0: shotgun.SetActive(false); uzi.SetActive(false); pistol.SetActive(true); nowWeaponText.text = "Pistol"; PistolUI.SetActive(true); shotgunUI.SetActive(false); uziUI.SetActive(false); break;
- case 1: shotgun.SetActive(true); uzi.SetActive(false); pistol.SetActive(false); nowWeaponText.text = "Shotgun"; PistolUI.SetActive(false); shotgunUI.SetActive(true); uziUI.SetActive(false); break;
- case 2: shotgun.SetActive(false); uzi.SetActive(true); pistol.SetActive(false); nowWeaponText.text = "Uzi"; PistolUI.SetActive(false); shotgunUI.SetActive(false); uziUI.SetActive(true); break;
- }
- }
- public void nextWeapon()
- {
- if(nowWeapon < 2)
- {
- nowWeapon++;
- }
- }
- public void previousWeapon()
- {
- if (nowWeapon > 0)
- {
- nowWeapon--;
- }
- }
- public void upgradePistolDamage()
- {
- if (pistolDamage < 150)
- {
- pistolDamage += 25;
- }
- }
- public void upgradePistolSpeed()
- {
- if (pistolSpeed < 2.25f)
- {
- pistolSpeed += 0.25f;
- }
- }
- public void upgradeShotgunDamage()
- {
- if (shotgunDamage < 175)
- {
- shotgunDamage += 25;
- }
- }
- public void upgradeShotgunAmmo()
- {
- if (shotgunAmmo < 60)
- {
- shotgunAmmo += 10;
- }
- }
- public void upgradeShotgunSpeed()
- {
- if (pistolSpeed < 2.25f)
- {
- shotgunSpeed += 0.25f;
- }
- }
- public void upgradeUziDamage()
- {
- if (uziDamage < 175)
- {
- uziDamage += 25;
- }
- }
- public void upgradeUziAmmo()
- {
- if (shotgunAmmo < 175)
- {
- uziAmmo += 25;
- }
- }
- public void upgradeUziSpeed()
- {
- if (uziSpeed < 3.25f)
- {
- uziSpeed += 0.25f;
- }
- }
- }
Add Comment
Please, Sign In to add comment