示例#1
0
        /// <summary>
        /// Cancels the countdown timer.
        /// </summary>
        void CancelCountdown()
        {
            RoomData.GameStarted = false;

            // Notify players
            Players.ForEach(x => x.NotifyRoomCountdownCancel());

            if (CountdownTimer != null)
                CountdownTimer.Stop();

            CountdownTimer = null;
        }
示例#2
0
        /// <summary>
        /// Begins a countdown timer. The game will begin if the timer reaches 0.
        /// </summary>
        void StartCountdown()
        {
            RoomData.GameStarted = true;

            // Notify players
            Players.ForEach(x => x.NotifyRoomCountdownStart(5f));

            // Start game when countdown reaches 0
            CountdownTimer = new GameTimer("Countdown", 5f, () =>
            {
                Logger.Log(this, "{0} has started the game", Owner.Data.Name);
                Game = new DrawesomeGame(ConnectionsHandler, Settings.Values);
                Game.Start(Players);
                Game.OnEnd += OnGameEnd;
            });
        }