public void BuildMine() { if (plusGold == 0) { functionTimerGold = new FuncTimer(PlusGold, secondsToUpdateGold, "goldRemainder"); } plusGold += 1; PlayerPrefs.SetInt("plusGold", plusGold); }
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; }
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"); }
public void WhenFuncDoesReturnTrueBeforeTimeout_ThenReturnTrue() { var result = FuncTimer.WaitFuncReturnsTrueOrTimeout(() => true, _timeSpan); Assert.That(result, Is.True); }
public void WhenFuncIsNull_ThenThrowException() { Assert.Throws <ArgumentNullException>(() => FuncTimer.WaitFuncReturnsTrueOrTimeout(null, _timeSpan)); }