Example #1
0
 public void ResetTime()
 {
     timeRemaining = maxTime;
     time          = 0;
     OnTimeChanged?.Invoke(maxTime);
     pro.SetText(Math.Floor(timeRemaining).ToString());
 }
Example #2
0
 void VlcMediaPlayer_TimeChanged(object sender, EventArgs e)
 {
     if (OnTimeChanged != null)
     {
         OnTimeChanged.Invoke(this, EventArgs.Empty);
     }
 }
Example #3
0
 void OnTimeSet(string timeString)
 {
     if (float.TryParse(timeString, out float time))
     {
         OnTimeChanged?.Invoke(time);
     }
 }
Example #4
0
    IEnumerator StartTimer()
    {
        while (_levelInProgress && _timeLeft > 0)
        {
            yield return(new WaitForSeconds(1));

            _timeLeft -= 1;
            OnTimeChanged?.Invoke(_timeLeft);


            if (_nextWarningIndex < TimeLeftWhenWarningPlays.Count)
            {
                if (_nextWarningIndex > 0 && _timeLeft > TimeLeftWhenWarningPlays[_nextWarningIndex - 1])
                {
                    _nextWarningIndex--;
                }

                if (_timeLeft == TimeLeftWhenWarningPlays[_nextWarningIndex])
                {
                    OnWarning?.Invoke(_timeLeft);
                    _nextWarningIndex++;
                }
            }

            if (_timeLeft == 0)
            {
                WhenTimeRunsOut();
            }
        }
    }
Example #5
0
 private void StartLevelTimer()
 {
     _dialogSystem.StartSingleLine("Area02_start_timer");
     _nextWarningIndex = 0;
     timerCoroutine    = StartCoroutine(StartTimer());
     TimerPanel.SetActive(true);
     OnTimeChanged?.Invoke(_timeLeft);
 }
        public HorsifyVlcMediaController(string vlcPath)
        {
            _vlcPlayer = new VlcPlayer(vlcPath);
            _vlcPlayer.Init();
            _isInitialized = true;

            _vlcPlayer.MediaFinished += () => OnMediaFinished?.Invoke();
            _vlcPlayer.MediaLoaded   += (x) => OnMediaLoaded?.Invoke(x);
            _vlcPlayer.TimeChanged   += (x) => OnTimeChanged?.Invoke(x);
        }
 private void EndTriAttack()
 {
     if(debugMarker != null) debugMarker.gameObject.SetActive(false);
     positions.Clear();
     characterAfterImage.EndAfterImage();
     characterMovement.OnCollisionWall -= CallWallCollision;
     isTriAttacking = false;
     characterMovement.EndMove();
     characterAnimation.State = CharacterState.Idle;
     if (OnTimeChanged != null) OnTimeChanged.Invoke(0, 0);
     if (OnEndAction != null) OnEndAction.Invoke(idAttacker);
 }
Example #8
0
    private IEnumerator MeasureTime()
    {
        var delay = Yielder.WaitForSeconds(1f);

        while (true)
        {
            yield return(delay);

            elapsedSeconds++;
            OnTimeChanged?.Invoke(elapsedSeconds);
        }
    }
Example #9
0
        private void SecondDone()
        {
            ++_timePassed;

            _schedule.SecondDone();
            OnTimeChanged?.Invoke();

            if (_timePassed == _timeGeneral)
            {
                TimeDone();
            }
        }
        /// <summary>
        /// Todo. Crossfades / Two decks
        /// </summary>
        /// <param name="vlcPath"></param>
        /// <param name="dualmode"></param>
        public HorsifyVlcMediaController(string vlcPath, bool dualmode) : this(vlcPath)
        {
            if (dualmode)
            {
                _vlcPlayer2 = new VlcPlayer(vlcPath);
                _vlcPlayer2.Init();
                _vlcPlayer2IsInitialized = true;

                _vlcPlayer2.MediaFinished += () => OnMediaFinished?.Invoke();
                _vlcPlayer2.MediaLoaded   += (x) => OnMediaLoaded?.Invoke(x);
                _vlcPlayer2.TimeChanged   += (x) => OnTimeChanged?.Invoke(x);
            }
        }
Example #11
0
 // Update is called once per frame
 void Update()
 {
     if (curTime > 0 && _startTimer)
     {
         curTime -= Time.deltaTime;
         OnTimeChanged?.Invoke(this, new OnTimeChangedEventArgs {
             currentTime = (int)curTime
         });                                                                                     //call event to change the text field content
         if (curTime <= 0)
         {
             OnStartSignal?.Invoke(this, EventArgs.Empty);//call event to activate movement
         }
     }
 }
Example #12
0
        public void ScrollTo(Weeks week, int year = -1)
        {
            if (year != -1)
            {
                this.Year = year;
            }
            else if ((int)week < (int)Now)
            {
                this.Year++;
            }

            Now = week;

            OnTimeChanged?.Invoke();
        }
Example #13
0
 public void Next()
 {
     OnEndOfTurn?.Invoke();
     if (Now == Weeks.DecemberFourth)
     {
         Year++;
         Now = Weeks.JanuaryFirst;
     }
     else
     {
         Now++;
     }
     OnTimeChanged?.Invoke();
     OnStartTurn?.Invoke();
 }
Example #14
0
        private void Update()
        {
            if (timer > 0 && !timeout)
            {
                timer -= Time.deltaTime;
                OnTimeChanged.Invoke(timer);
            }
            else if (timer < 0 && !timeout)
            {
                timeout = true;
                OnTimeout.Invoke();

                if (loop)
                {
                    StartTimer();
                }
            }
        }
Example #15
0
    void Update()
    {
        if (startedTime && timer > 0)
        {
            timer -= Time.deltaTime;
            OnTimeChanged.Invoke(timer);

            SendReadableTime();
        }
        else if (startedTime)
        {
            timer       = 0;
            startedTime = false;
            OnTimeEnded.Invoke();

            SendReadableTime();
        }
    }
 //   U P D A T E
 private IEnumerator TriAttackCoroutine()
 {
     characterMovement.StartupMove();
     t = 0f;
     while (t < time)
     {
         t += Time.deltaTime * characterAnimation.GetMotionSpeed();
         if (isJumping == true)
             UpdateJumpTriAttack();
         else
             UpdateMovement();// Pas framerate machin < ------------------ Il est là le problème
         if (OnTimeChanged != null) OnTimeChanged.Invoke(totalDistance - (currentDistance - (new Vector2(destination.x, destination.z) - PositionToVector2()).magnitude), totalDistance);
         CheckIntersection();
         CheckCollision();
         yield return null;
     }
     EndTriAttackCoroutine();
 }
Example #17
0
    private void UpdateTimer()
    {
        if (pause)
        {
            return;
        }
        timeRemaining = (maxTime - time);

        pro.SetText(Math.Floor(timeRemaining).ToString());
        time += Time.fixedDeltaTime;

        OnTimeChanged?.Invoke(timeRemaining);

        if (timeRemaining <= 0)
        {
            time = 0;
            outOfTime?.Invoke();
        }
    }
Example #18
0
    IEnumerator TickClock()
    {
        while (timeActivated)
        {
            yield return(new WaitForSeconds(10f));

            currentMinutes += 10;

            if (currentMinutes >= 60)
            {
                HandleHour();

                if (currentHour == 12)
                {
                    HandleTimeOfTheDay();
                }

                if (currentHour > 12)
                {
                    currentHour = 1;
                }
            }

            if (currentHour == 12 && currentTimeOfTheDay == TimeOfTheDay.AM)
            {
                currentHour = 0;
                SetDangerousTime(true);
            }


            if (currentHour == 2 && currentTimeOfTheDay == TimeOfTheDay.AM)
            {
                FinishDay();
            }

            if (onTimeChangedCallback != null)
            {
                onTimeChangedCallback.Invoke();
            }
        }
    }
Example #19
0
 internal void SystemEvents_TimeChanged(object sender, EventArgs e)
 {
     OnTimeChanged?.Invoke(sender, e);
 }
Example #20
0
    private void SetTime(int time)
    {
        Time.timeScale = time;

        OnTimeChanged?.Invoke(time);
    }
Example #21
0
 private void RefreshTime()
 {
     OnTimeChanged?.Invoke(this, new TimeEventArgs(CurrentTime));
 }
Example #22
0
 private void TimeChanged(object sender, double seconds)
 {
     OnTimeChanged?.Invoke(seconds);
     _appWebServer.OnTimeChanged?.Invoke(seconds);
 }