Example #1
0
        /// <summary>
        /// Tracks a timeout requested by specified team
        /// </summary>
        /// <param name="id">Team ID</param>
        /// <returns></returns>
        public Match Timeout(TeamId id)
        {
            if (!IsValid())
            {
                return(this);
            }

            // Should we do it?
            if (!CanRequestTimeout(id))
            {
                return(this);
            }

            switch (id)
            {
            case TeamId.Home:
                TimeoutCount1 = TimeoutCount1.Increment(MaxTimeoutsPerPeriod);
                break;

            case TeamId.Visitors:
                TimeoutCount2 = TimeoutCount2.Increment(MaxTimeoutsPerPeriod);
                break;
            }

            IsBallInPlay = false;
            State        = MatchState.Timeout;
            return(this);
        }
Example #2
0
        /// <summary>
        /// Tracks a timeout requested by specified team
        /// </summary>
        /// <param name="id">Team ID</param>
        /// <returns></returns>
        public Match Timeout(TeamId id)
        {
            if (!IsValid())
            {
                return(this);
            }

            // Should we do it?
            if (!CanRequestTimeout(id))
            {
                return(this);
            }

            switch (id)
            {
            case TeamId.Home:
                TimeoutCount1 = TimeoutCount1.Increment(MaxTimeoutsPerPeriod);
                break;

            case TeamId.Visitors:
                TimeoutCount2 = TimeoutCount2.Increment(MaxTimeoutsPerPeriod);
                break;

            case TeamId.Unknown:
            default:
                throw new ArgumentOutOfRangeException(nameof(id), id, null);
            }

            IsBallInPlay = false;
            State        = MatchState.Timeout;
            return(this);
        }