Beispiel #1
0
        private static ICueBallGame CreatePoolGame(CueBallGameType gameType, ICueBallGameReferee referee, IPlayer player1,
                                                   IPlayer player2)
        {
            LazyInitializer.EnsureInitialized(ref _gameCreationDelegates, SetupGameCreationalDelegates);

            var game = _gameCreationDelegates[gameType](referee, player1, player2);

            return(game);
        }
Beispiel #2
0
        protected CueBallGame(ICueBallGameReferee cueBallGameReferee, CueBallGameType gameType, IPlayer player1, IPlayer player2)
        {
            _cueBallGameReferee = cueBallGameReferee;
            _ballsOnTable       = new List <Ball>();

            foreach (var ballType in gameType.GetAllGameBalls())
            {
                AddBall(ballType);
            }

            _cueBallGameReferee.Initialize(this);
            _cueBallGameReferee.SetPlayers(player1, player2);
        }
Beispiel #3
0
 public EightBallGame(ICueBallGameReferee referee, IPlayer player1, IPlayer player2)
     : base(referee, CueBallGameType.EightBall, player1, player2)
 {
     GamePhase = GamePhases.OpenTable;
 }
Beispiel #4
0
 public BlackballGame(ICueBallGameReferee referee, IPlayer player1, IPlayer player2)
     : base(referee, CueBallGameType.Blackball, player1, player2)
 {
 }
Beispiel #5
0
 public Snooker(ICueBallGameReferee cueBallGameReferee, IPlayer player1, IPlayer player2)
     : base(cueBallGameReferee, CueBallGameType.Snooker, player1, player2)
 {
 }
Beispiel #6
0
 public static TGameType CreatePoolGame <TGameType>(CueBallGameType cueBallGameType, ICueBallGameReferee referee,
                                                    IPlayer player1, IPlayer player2)
 {
     return((TGameType)CreatePoolGame(cueBallGameType, referee, player1, player2));
 }