Beispiel #1
0
    public void BuildMine()
    {
        if (plusGold == 0)
        {
            functionTimerGold = new FuncTimer(PlusGold, secondsToUpdateGold, "goldRemainder");
        }

        plusGold += 1;
        PlayerPrefs.SetInt("plusGold", plusGold);
    }
Beispiel #2
0
    private void CheckSeconds(int diff, int secondsToUpdate, FuncTimer funcTimer, string nameValue)
    {
        int remainder;
        int result = Math.DivRem(diff, secondsToUpdate, out remainder);

        if (result != 0)
        {
            result *= plusGold;
            ChangeValues(nameValue, result);
        }
        else
        {
            ChangeValues("", result);
        }
        funcTimer.timerValue -= remainder;
    }
Beispiel #3
0
    void Start()
    {
        anim = GameObject.Find("Train_001").GetComponent <Animation>();
        TakeValues();

        #region CheckTime
        DateTime endDate = Utils.GetDateTime("LastSaveDate", DateTime.UtcNow);
        TimeSpan diff    = DateTime.UtcNow - endDate;
        diffSeconds = (int)diff.TotalSeconds;
        diffSeconds = Mathf.Clamp(diffSeconds, 0, 7 * 24 * 60 * 60);

        if (plusGold >= 1)
        {
            functionTimerGold = new FuncTimer(PlusGold, secondsToUpdateGold, "goldRemainder");
            CheckSeconds(diffSeconds, secondsToUpdateGold, functionTimerGold, "gold");
        }
        #endregion

        ChangeTempValue(diffSeconds);
        StartCoroutine("AsteroidAnim");
    }
Beispiel #4
0
            public void WhenFuncDoesReturnTrueBeforeTimeout_ThenReturnTrue()
            {
                var result = FuncTimer.WaitFuncReturnsTrueOrTimeout(() => true, _timeSpan);

                Assert.That(result, Is.True);
            }
Beispiel #5
0
 public void WhenFuncIsNull_ThenThrowException()
 {
     Assert.Throws <ArgumentNullException>(() => FuncTimer.WaitFuncReturnsTrueOrTimeout(null, _timeSpan));
 }