コード例 #1
0
        private void TimerOnTimesUp()
        {
            TimesUp?.Invoke();
            TimesUpAtTime?.Invoke(DateTime.Now);

            PlayerPrefsX.SetDateTime(name, DateTime.Now);
            PlayerPrefs.Save();
        }
コード例 #2
0
ファイル: PlayerTimer.cs プロジェクト: Fabernaz/Chess
 private void CheckForTimesUp()
 {
     if (_millisecondsLeft <= 0)
     {
         _timer.Stop();
         TimesUp?.Invoke(this, new EventArgs());
         _millisecondsLeft = 0;
     }
 }
コード例 #3
0
ファイル: GameEvents.cs プロジェクト: pavel-fadrhonc/Fokusiro
        public void BroadCastTimesUpEvent()
        {
            if (GameState.instance.State != eGameState.Running)
            {
                return;
            }

            TimesUp?.Invoke();
        }
コード例 #4
0
    void Countdown()
    {
        if (!isTimeOut)
        {
            Timer -= Time.deltaTime;

            if (Timer < 0)
            {
                TimesUp.Invoke();
                isTimeOut = true;
            }
        }
    }
コード例 #5
0
ファイル: run.cs プロジェクト: keepview/PFD_ServerV1.1
        public void RebootPipe(DataRec dr)
        {
            Process pr = new Process();//启动管道

            pr.StartInfo.WorkingDirectory = @"..\..\..\..\..\..\C++\" + CamID.ToString() + @"\Release";
            pr.StartInfo.FileName         = "CarDetect" + CamID.ToString() + ".exe";
            pr.StartInfo.WindowStyle      = ProcessWindowStyle.Minimized;
            pr.Start();

            TimesUp tu = new TimesUp(reboot);

            tu.BeginInvoke(dr, MyAsyncCallback, null);
        }
コード例 #6
0
        void Update(float deltaTime)
        {
            if (RemainTime <= 0)
            {
                return;
            }

            if (IsPaused)
            {
                return;
            }

            if (IsCompleted)
            {
                return;
            }

            RemainTime -= deltaTime;
            RemainTime  = Mathf.Max(0, RemainTime);

            var currentSeconds = Mathf.FloorToInt(RemainTime) + 1;
            var wasSeconds     = Mathf.FloorToInt(lastFrameTime) + 1;

            if (currentSeconds != wasSeconds)
            {
                SecondsChanged?.Invoke(currentSeconds);
            }

            if (RemainTime == 0)
            {
                SecondsChanged?.Invoke(0);
                TimesUp?.Invoke();

                if (LoopCount > 0)
                {
                    LoopCount--;
                }

                if (LoopCount != 0)
                {
                    RemainTime = time;
                }
                else
                {
                    Complete();
                }
            }

            lastFrameTime = RemainTime;
        }
コード例 #7
0
 public static void OnTimesUp(object sender, EventArgs e)
 {
     TimesUp?.Invoke(sender, e);
 }
コード例 #8
0
ファイル: Game.cs プロジェクト: DanielJHart/Three-Letters
    /// <summary>
    /// Change to state
    /// </summary>
    /// <param name="to">State to change to</param>
    private void ChangeState(GameState to)
    {
        Debug.Log("Change State To: " + to);

        switch (to)
        {
        case GameState.Advert:
            gameState = GameState.Advert;

#if UNITY_IOS || UNITY_ANDROID
            // Show ad if need to, else go to game
            if (Ads.NeedAdvert())
            {
                Ads.ShowAd();
            }
            else
            {
                ChangeState(GameState.Countdown);
            }
#else
            // No ads on PC, Go to game
            ChangeState(GameState.Countdown);
#endif

            break;

        case GameState.Countdown:

#if UNITY_IOS || UNITY_ANDROID
            if (!adRewarded)
            {
                // Reset points if not in extra time
                points = 0;
            }
#else
            // Reset points
            points = 0;
#endif

            gameState = GameState.Countdown;

            //TODO: Remove This
            ChangeState(GameState.Game);
            break;

        case GameState.Game:
            Setup();
            if (!adRewarded && !restarting && gameMode != GameMode.Welcome)
            {
                answers = new List <string>();
                menu.GoToGame();
                if (restarting)
                {
                    restarting = false;
                }
            }
            canFocus = true;
            if (gameMode != GameMode.Welcome)
            {
                ActivateInputField();
            }
            gameState = GameState.Game;
            break;

        case GameState.GameOver:
            canFocus = false;
            input.DeactivateInputField();
            TimesUp.Invoke();
            timeLeft  = 2;
            gameState = GameState.GameOver;
            break;

        case GameState.Leaderboard:
            gameState = GameState.Leaderboard;
            ResetLetters();
            adRewarded = false;

            FindObjectOfType <RerollButtonsBehaviour>().Reset();
            rerollUsed = false;
            restarting = false;

            if (gameMode == GameMode.Classic || gameMode == GameMode.TimeTrial)
            {
                if (points > scores.GetBestScore(gameMode, difficulty))
                {
                    menu.BestScore();
                    scores.SaveBestScore(gameMode, difficulty, points);
                    audioManager.PlaySoundEffect("BestScore");
                }
                else
                {
                    menu.ScoreScreenEnter();
                }
            }
            else if (gameMode == GameMode.Challenge)
            {
                if (points >= challengeInfo.Target)
                {
                    // Congrats
                    menu.BestScore();
                    audioManager.PlaySoundEffect("BestScore");
                    challengeGenerator.SetChallengeComplete(challengeInfo.LevelName);
                    // Set as complete
                }
                else
                {
                    // Better Luck Next Time
                    menu.OpenChallengeFailed();
                }
            }
            else
            {
                // Show some stuff
                menu.OpenWelcomeComplete();
                timeLeft = 3;
            }

            break;

        case GameState.ExtraTimeAdvert:
            menu.OpenWatchAd();
            gameState = GameState.ExtraTimeAdvert;
            break;

        case GameState.Pregame:
            gameState = GameState.Pregame;
            break;
        }
    }
コード例 #9
0
ファイル: TimerControl.xaml.cs プロジェクト: j0eyWh/Typist
 private void OnTimesUp()
 {
     TimesUp?.Invoke(this, EventArgs.Empty);
 }
コード例 #10
0
 protected virtual void OnTimesUp(object sender, TimesUpEventArgs e)
 {
     TimesUp?.Invoke(sender, e);
 }