コード例 #1
0
ファイル: RefereeBox.cs プロジェクト: SergeLegros/RoboCup2020
        public bool EndPart()
        {
            if (IsStopped)
            {
                // Update part to go to the next one
                _initialPartTime         = DateTime.Now;
                IsChangingScore          = false;
                IsInitialPartKickOffDone = false;
                GameStopwatch.Reset();

                string command;
                // Send new game part commands
                switch (GamePart)
                {
                case GameParts.FirstHalf:
                    command  = "HALF_TIME";
                    GamePart = GameParts.PreSecondHalf;
                    break;

                case GameParts.SecondHalf:
                    command  = "END_GAME";
                    GamePart = GameParts.PreFirstHalfOvertime;
                    break;

                case GameParts.FirstHalfOvertime:
                    command  = "HALF_TIME";
                    GamePart = GameParts.PreSecondHalfOvertime;
                    break;

                case GameParts.SecondHalfOvertime:
                    command  = "END_GAME";
                    GamePart = GameParts.Penalties;
                    break;

                case GameParts.Penalties:
                    command  = "HALF_TIME";
                    GamePart = GameParts.GameOver;
                    break;

                default:
                    return(false);
                }

                SendCommand(command);
            }

            return(IsStopped);
        }
コード例 #2
0
ファイル: RefereeBox.cs プロジェクト: SergeLegros/RoboCup2020
        public bool Reset()
        {
            if (IsStopped)
            {
                GamePart         = GameParts.PreFirstHalf;
                _initialPartTime = DateTime.Now;

                IsInitialPartKickOffDone = false;
                LastTeamToKickOff        = TeamColors.None;
                GameStopwatch.Reset();

                CyanScore    = 0;
                MagentaScore = 0;

                SendCommand(Commands.RESET);
            }

            return(IsStopped);
        }