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); }
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); }
public EightBallGame(ICueBallGameReferee referee, IPlayer player1, IPlayer player2) : base(referee, CueBallGameType.EightBall, player1, player2) { GamePhase = GamePhases.OpenTable; }
public BlackballGame(ICueBallGameReferee referee, IPlayer player1, IPlayer player2) : base(referee, CueBallGameType.Blackball, player1, player2) { }
public Snooker(ICueBallGameReferee cueBallGameReferee, IPlayer player1, IPlayer player2) : base(cueBallGameReferee, CueBallGameType.Snooker, player1, player2) { }
public static TGameType CreatePoolGame <TGameType>(CueBallGameType cueBallGameType, ICueBallGameReferee referee, IPlayer player1, IPlayer player2) { return((TGameType)CreatePoolGame(cueBallGameType, referee, player1, player2)); }