Quantcast
Channel: Questions in topic: "upgrade"
Viewing all articles
Browse latest Browse all 371

Upgrade once per click on Button c#

$
0
0
Hi all, my problem is maybe just small. I want to go up an age once the player reached an amount of exp. I have one button to click, and connected the function to it. But if i click the button, it goes through all, und it fits. How can i stop it, once it reached the first statement even if i could upgrade more than 1 times? public void GoAgeUp() { if (GM.exp >= 500) { Debug.Log ("egypts age"); GM.age = 2; EDP.StoneAgeUnitsPanel.SetActive (false); EDP.StoneAgeTurretsPanel.SetActive (false); } if (GM.exp >= 8000) { Debug.Log ("medieval age"); GM.age = 3; EDP.EqyptsUnitsPanel.SetActive (false); EDP.EqyptsTurretsPanel.SetActive (false); } if (GM.exp >= 12000) { GM.age = 4; } if (GM.exp >= 16000) { GM.age = 5; } if (GM.exp >= 20000) { GM.age = 6; } } Thanks in advance.

Viewing all articles
Browse latest Browse all 371

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>