Hallo. How can I give a gift to a player, who play the game regurarly, like for each day he plays, he get 1000 monay. How to do that ?![]()
Perhaps a couple of variables, one to track if the player has played today, and another to track the number of days in a row they play.
From there, itโs just a matter of getting the system time/date, loading, updating, and saving it on launch, and an if statement to to check if the player has met your criteria, and award the gift.
Use System.DateTime.Now. So for example, just before a game session ends, insert this:
var lastDay : int = System.DateTime.Now.get_Day();
And then, when a player relogs back in, in your Start () function, check whether itโs been less than a day since they were last on:
function Start () {
if (System.DateTime.Now.get_Day() - lastDay == 1) {
Debug.Log("Have lotsa money!");
}
}
That should work. ![]()
Hope that helps, Klep