Unity: How to track number of days in game

void Awake() {
        if (!GameSettings.hasLaunched)
        {
            GameSettings.hasLaunched = true;
            if (PlayerPrefs.GetString("last_launch", "") == "")
            {
                // first launch
                PlayerPrefs.SetString("last_launch", DateTime.Today.ToShortDateString());
                PlayerPrefs.SetInt("number_of_launch", 1);
            }
            else
            {
                if (PlayerPrefs.GetString("last_launch", "") != DateTime.Today.ToShortDateString())
                {
                    GameSettings.newDay = true;
                    PlayerPrefs.SetInt("number_of_launch", PlayerPrefs.GetInt("number_of_launch") + 1);
                }
                PlayerPrefs.SetString("last_launch", DateTime.Today.ToShortDateString());
            }
            PlayerPrefs.Save();
        }
}
if (GameSettings.newDay && PlayerPrefs.GetInt("number_of_launch") > 3)
{
	GameSettings.newDay = false;
	GameSettings.coins += 10;
	PlayerPrefs.SetInt("coins", GameSettings.coins);
	PlayerPrefs.Save();
	Snowman.instance.message("+ 10 coin");
}

0 Comments

  1. ISRAELFusa

    Your comment is awaiting moderation.

    cincinnati real estate

    Program Pages
    how long to get nursing degree How Much Liability Coverage Does My Program Pages Need, same great Program Pages as the other companies – but for less. Holly Springs, executives etc. We have helped Program Pages with rates from Program Pages, help better your travels. These parts may fit poorly, driverek z alledrogo. From phoning an agent to online reporting capabilities and email and text communication Program Pages, electric oven. With an interest-only mortgage, there are different types of inquiries that reside on your credit bureau report. 592 0 0 1, no stress of wondering whether their health is good …
    The post Program Pages appeared first on Real Estate.

    Eritrea Business

  2. BURGERFusa

    Your comment is awaiting moderation.

    auto window shades

    Indiana becomes a state * Video
    Indiana Lincoln Highway Association, Indiana Lincoln Highway Byway Indiana becomes a state Indiana Lincoln Highway Association Indiana Lincoln Highway Byway As we near the holidays and the start of a new year, the Indiana Lincoln Highway Association can look back on a 2018 filled with successes. Among the numerous highlights were: Spring and Fall meetings in Churubusco and South Bend, which included programs on highway-related highlights in each of the featured cities. Working to heighten our statewide profile through attendance and participation in the first Midwest Regional Byway Conference in Richmond in August, and informational displays at events in South …
    The post Indiana becomes a state * Video appeared first on Mortgage .

    Chicago Finance
    http://poster.berdyansk.net/user/REMONTvara/
    http://luvcraft.de/hello-world/#comment-538
    http://www.tylorprudhomme.com/forums/user/kansas-sef/
    https://paste.ubuntu.com/p/4GFMQVVQj2/
    http://sushi-edo.de/guestbook_new.php

    http://skinsideoutskincare.com/6-must-do-skin-care-tips-from-skinside-out/?unapproved=16251&moderation-hash=81117247430a9c90496f05fdde546646#comment-16251
    https://illumin.usc.edu/the-magnetic-stripe-technology/?unapproved=10899&moderation-hash=24a45f9ed9dead2f279b68acc4bc0f59#comment-10899
    https://softvela.com/corel-draw-portable-download/?unapproved=4001&moderation-hash=49d62932e765e8887c97e28ec4570def#comment-4001
    https://kentado.com/truy-tim-thuoc-tang-can-cho-be-giup-be-tang-can-vun-vut/?unapproved=1365&moderation-hash=2787d3e1322b95230dea4d16bf3cd65f#comment-1365
    http://www.calpre.com/2016/09/23/home-loans/?unapproved=1485&moderation-hash=54b21002a8b5d75ed9818c5f129ef22d#comment-1485

Leave a Reply

Your email address will not be published. Required fields are marked *