Quantcast
Channel: Answers by "Paparakas"
Viewing all articles
Browse latest Browse all 27

Answer by Paparakas

$
0
0
You could use Time.time http://docs.unity3d.com/Documentation/ScriptReference/Time-time.html Let's say in your game, every second counts as a day. You could use Time.time to check how many seconds have gone by, and use that to see if the time was at a certain point. An extremely simple example would be: private float weeksSinceLastPayUp = 0; private float daysSinceLastPayUp = 0; private float TimePassed = 0; void Update() { daysSinceLastPayUp = Time.time - TimePassed weeksSinceLastPayUp = days / 7; if(weeksSinceLastPayUp >= 4) { this.points += 10; TimePassed += daysSinceLastPayUp; daysSinceLastPayUp = 0; weeksSinceLastPayUp = 0; }

Viewing all articles
Browse latest Browse all 27

Trending Articles



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