public void NumberOfTasksFinished_EqualsNumberOfTimerTicks() { using (var timer = GetTimer()) { var tasks = timer.Take(10).ToArray(); for (int i = 1; i < 10; ++i) { _customTimer.Tick(); Assert.IsTrue(tasks.Take(i).All(IsFinished), $"Expected tasks {i} tasks to be finished"); Assert.IsFalse(tasks.Skip(i).Any(IsFinished), $"Expected tasks after {i} to be not finished"); } } }
private void Update() { if (m_timer.Tick(Time.deltaTime)) { SpawnBox(); } }
private void Invulnerable() { if (!m_invul) { return; } if (!m_invulTimer.Tick(Time.deltaTime)) { return; } m_invul = false; gameObject.layer = m_normalLayer; }
private void DestructionLogic() { //if we do not want to destroy return if (!m_destroy) { return; } if (m_deathTimer.Tick(Time.deltaTime)) { Destroy(gameObject); } //if the timer is currently still running else { var timerPercentage = m_deathTimer.GetTimerPercentage(true); if (transform.localScale.x < m_minimumScale) { return; } transform.localScale = m_initialScale * timerPercentage; } }
private void FixedUpdate() { CustomTimer.Tick(); }