示例#1
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 300;

        if (Instance == null)
        {
            Instance = this;
        }

        Time.timeScale = 0;

        Candies = new List <GameObject>();
        Gold    = GetGoldAmount();
        AddGold(9999999);
        FormatNumberB(Gold);

        //Set Monster level properties
        MonsterLevel   = GetMonsterLevel();
        LevelText.text = "Lv " + MonsterLevel;

        //Set Experience Properties
        Experience = GetMonsterExperience();
        SetExpText();
        GetContentPos();

        //Get time difference
        DateTime timeNow   = System.DateTime.Now;
        String   timeEnded = PlayerPrefs.GetString("SystemTime", "");

        if (timeEnded != "") //Idle progression not applicable on running the game first time
        {
            var diff = (timeNow - Convert.ToDateTime(timeEnded)).TotalSeconds;
            TimeDiff = Convert.ToInt32(diff);
            var expGained = Level.IdleExperienceGained(TimeDiff);
            ExpGained    = expGained; //Monster script will access it later
            IdleExp.text = "" + FormatNumberB(expGained);
        }
        else
        {
            ButtonIdle();
        }
        //Run system time logging
        StartCoroutine(LogSystemTime());
    }