View difference between Paste ID: xhezjXK8 and KLuDeLqB
SHOW: | | - or go back to the newest paste.
1
using System.Collections;
2
using System.Collections.Generic;
3
using UnityEngine;
4
using UnityEngine.UI;
5
6
public class upgradesScript : MonoBehaviour
7
{
8
9
    public static upgradesScript instance;
10
    public GameObject pistol;
11
    public GameObject shotgun;
12
    public GameObject uzi;
13
    public int nowWeapon;
14
    public Text nowWeaponText;
15
    // weapons upgrades
16
    public int pistolDamage;
17
    public int shotgunDamage;
18
    public int uziDamage;
19
    public int shotgunAmmo;
20
    public int uziAmmo;
21
    public float pistolSpeed;
22
    public float shotgunSpeed;
23
    public float uziSpeed;
24
    public GameObject PistolUI;
25
    public GameObject shotgunUI;
26
    public GameObject uziUI;
27
28
29
    void Start()
30
    {
31
        nowWeapon = 0;
32
    }
33
34
    // Update is called once per frame
35
    void Update()
36
    {
37
        switch (nowWeapon)
38
        {
39
            case 0:  shotgun.SetActive(false); uzi.SetActive(false); pistol.SetActive(true); nowWeaponText.text = "Pistol"; PistolUI.SetActive(true); shotgunUI.SetActive(false); uziUI.SetActive(false); break;
40
            case 1: shotgun.SetActive(true); uzi.SetActive(false); pistol.SetActive(false); nowWeaponText.text = "Shotgun"; PistolUI.SetActive(false); shotgunUI.SetActive(true); uziUI.SetActive(false); break;
41
            case 2: shotgun.SetActive(false); uzi.SetActive(true); pistol.SetActive(false); nowWeaponText.text = "Uzi"; PistolUI.SetActive(false); shotgunUI.SetActive(false); uziUI.SetActive(true); break;
42
        }
43
44
    }
45
    public void nextWeapon()
46
    {
47
        if(nowWeapon < 2)
48
        {
49
            nowWeapon++;
50
        }
51
        
52
    }
53
    public void previousWeapon()
54
    {
55
        if (nowWeapon > 0)
56
        {
57
            nowWeapon--;
58
        }
59
    }
60
    public void upgradePistolDamage()
61
    {
62
        if (pistolDamage < 150)
63
        {
64
            pistolDamage += 25;
65
        }
66
67
        }
68
    public void upgradePistolSpeed()
69
    {
70
        if (pistolSpeed < 2.25f)
71
        {
72
            pistolSpeed += 0.25f;
73
        }
74
    }
75
    public void upgradeShotgunDamage()
76
    {
77
        if (shotgunDamage < 175)
78
        {
79
            shotgunDamage += 25;
80
        }
81
82
    }
83
    public void upgradeShotgunAmmo()
84
    {
85
        if (shotgunAmmo < 60)
86
        {
87
            shotgunAmmo += 10;
88
        }
89
    }
90
     public void upgradeShotgunSpeed()
91
    {
92
        if (pistolSpeed < 2.25f)
93
        {
94
            shotgunSpeed += 0.25f;
95
        }
96
    }
97
    public void upgradeUziDamage()
98
    {
99
        if (uziDamage < 175)
100
        {
101
            uziDamage += 25;
102
        }
103
104
    }
105
    public void upgradeUziAmmo()
106
    {
107
        if (shotgunAmmo < 175)
108
        {
109
            uziAmmo += 25;
110
        }
111
    }
112
         public void upgradeUziSpeed()
113
    {
114
        if (uziSpeed < 3.25f)
115
        {
116
            uziSpeed += 0.25f;
117
        }
118
    }
119
}
120