예제 #1
0
        public Game(Pitch pith, Team homeTeam, Team awayTeam, MatchTime time)
        {
            Pith          = pith ?? throw new ArgumentNullException(nameof(pith));
            HomeTeam      = homeTeam ?? throw new ArgumentNullException(nameof(homeTeam));
            AwayTeam      = awayTeam ?? throw new ArgumentNullException(nameof(awayTeam));
            Time          = time ?? throw new ArgumentNullException(nameof(time));
            HomePositions = new PositionCollection();
            AwayPositions = new PositionCollection();

            // THIS SHOULD BE FIXED LATER
            positionOfHomeGoal = new Position {
                X = 1, Y = 1
            };
            positionOfAwayGoal = new Position {
                X = 2, Y = 2
            };
            Ball = new Ball();
        }
예제 #2
0
        public void ProcessPositionCollection(PositionCollection positionCollection, bool isHome)
        {
            if (positionCollection == null)
            {
                throw new ArgumentNullException(nameof(positionCollection));
            }

            if (isHome)
            {
                HomePositions = positionCollection;
            }
            else
            {
                AwayPositions = positionCollection;
            }

            DetermineScore();
            DetermineBallPossessor();
        }