Exemple #1
0
    void StartTimer()
    {
        Debug.Assert(_timerCoroutine == null, $"[{GetType()}] Timer is already working", this);

        TimeStarted?.Invoke(_gameDurationSeconds);
        _timerCoroutine = StartCoroutine(TimerProgress(_gameDurationSeconds));
    }
Exemple #2
0
        public void Start()
        {
            var ok = false;

            Busy        = true;
            TimeStarted = DateTime.Now;
            try
            {
                if (File.Exists(FileName))
                {
                    File.Delete(FileName);
                }
                try
                {
                    StartAction();
                    ok = true;
                }
                catch (Exception e)
                {
                    Retries += 1;
                }
            }
            finally
            {
                if (ok)
                {
                    Retries = 0;
                    Done    = true;
                }
                Busy = false;
            }
            TimeEnded = DateTime.Now;
            TimeTaken = TimeStarted.Subtract(TimeEnded);
        }