示例#1
0
 private void StartTimer()
 {
     if (timerRoutine == null)
     {
         timerRoutine = StartCoroutine(isCountUp ? CountUp() : CountDown());
         OnTimerStart?.Invoke();
     }
 }
示例#2
0
 public void Start()
 {
     if (_isAwake)
     {
         return;
     }
     OnTimerStart?.Invoke();
     _isAwake = true;
 }
示例#3
0
 public void Start()
 {
     if (_awake)
     {
         return;
     }
     _currentTime = initialTime;
     _awake       = true;
     OnTimerStart?.Invoke();
 }
        private void SetPlayerReadyState(IPlayer player)
        {
            PlayerReadyState[player] = !PlayerReadyState[player];

            if (Players.Count >= MinPlayersNeededToStart)
            {
                int readyPlayers = 0;
                foreach (bool val in PlayerReadyState.Values)
                {
                    if (val)
                    {
                        readyPlayers++;
                    }
                }

                OnTimerStart?.Invoke(new GameStartEventArgs(RoomID, MinPlayersNeededToStart,
                                                            MaxPlayersNeededToStart, readyPlayers, Players.ToArray()));
            }
        }