GetPrice
How do I use Get Price
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
80 | price = GetPrice (GameController.instance.weaponLevel); | 1 |
89 | private int GetPrice(int level){ | 2 |
File name: GameplayController.cs
Copy
78 void InitializeUpgradePrice(){
79 if (GameController.instance.weaponLevel != 5) {
80 price = GetPrice (GameController.instance.weaponLevel);
81 priceText.text = price.ToString ();
82 } else {
83 priceText.transform.GetChild (0).gameObject.SetActive (false);
84 priceText.text = "MAX";
85 }
86
87 }
File name: GameplayController.cs
Copy
89 private int GetPrice(int level){
90 int nextPrice = 0;
91
92 switch(level){
93
94 case 1:
95 nextPrice = 500;
96 break;
97
98 case 2:
99 nextPrice = 1200;
100 break;
101
102 case 3:
103 nextPrice = 2500;
104 break;
105
106 case 4:
107 nextPrice = 5000;
108 break;
109 }
110
111
112 return nextPrice;
113 }
GetPrice 149 lượt xem
Gõ tìm kiếm nhanh...