Beispiel #1
0
    IEnumerator TimerProgress(float duration)
    {
        yield return(new WaitForSeconds(duration));

        TimeEnded?.Invoke();
        _timerCoroutine = null;
    }
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     RemainTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;
     SetText(MathF.Round(RemainTime, 2).ToString());
     if (RemainTime <= 0)
     {
         TimeEnded?.Invoke();
         TimeEnded = null;
         Dispose();
     }
 }
Beispiel #3
0
    private bool NoTime()
    {
        var availableTimeElapsed = (_timer.Elapsed.TotalSeconds >= TimeFor1StarInSeconds) || _levelIsFinished;

        if (availableTimeElapsed)
        {
            _timer.Stop();

            if (!_levelIsFinished)
            {
                TimeEnded?.Invoke(this, (int)CalculateScore());
            }
            _levelIsFinished = true;
        }

        return(availableTimeElapsed);
    }
Beispiel #4
0
 protected virtual void OnTimeEnded(object source, TimeEndedEventArgs e)
 {
     TimeEnded?.Invoke(this, e);
 }
Beispiel #5
0
 /// <summary>
 /// Invocation d'event lorsque le temps de shopping est fini
 /// </summary>
 /// <param name="e">Argument de l'event</param>
 protected void OnTimeEnded(EventArgs e)
 {
     //Invoquer l'event si TimeEnded n'est pas null
     TimeEnded?.Invoke(this, e);
 }