private void PlayLevel(LevelData levelData) { CellsField.Play(levelData); switch (levelData.LoseConditionType) { case LoseConditionType.LimitedTime: GameOverChecker = new LimitedTimeGameOverChecker(levelData.LoseConditionValue); break; case LoseConditionType.LimitedMoves: GameOverChecker = new LimitedMovesGameOverChecker(CellsField, levelData.LoseConditionValue); break; default: throw new ArgumentOutOfRangeException(); } GameOverChecker.OnGameOver += OnGameOver; WinChecker = new TargetsWinChecker(CellsField, levelData.Targets.ToList()); WinChecker.OnWin += OnWin; App.Instance .WindowManager .Show <LevelInfoWindow>() .Initialize(GameOverChecker, WinChecker, Pause); }
public Game(ICollection <Player> players, IWinChecker winChecker, ILogger <Game> logger) { Players = players; _logger = logger; _winChecker = winChecker; GameState = new GameState(); }
public GameEngine(List <FieldButton> fields, Label status) { _status = status; _fields = fields; _playerOne = new Player('X', 1); _playerTwo = new Player('O', 2); _checker = new WinChecker(fields, this); StartGame(); }
public WinCombination(string description, IWinChecker winChecker, int oneCreditPayout, int twoCreditPayout, int threeCreditPayout, int fourCreditPayout, int fiveCreditPayout) { Description = description; WinChecker = winChecker; OneCreditPayout = oneCreditPayout; TwoCreditPayout = twoCreditPayout; ThreeCreditPayout = threeCreditPayout; FourCreditPayout = fourCreditPayout; FiveCreditPayout = fiveCreditPayout; }
/// <summary> /// Constructor used for unit testing /// </summary> /// <param name="board">The board</param> /// <param name="renderer">The board renderer</param> /// <param name="winChecker">The win checker</param> /// <param name="inputprovider">The input provider</param> /// <param name="outputProvider">The output provider</param> public GameManager(IBoard board, IBoardRenderer renderer, IWinChecker winChecker, IInputProvider inputProvider, IOutputProvider outputProvider) { // validate the inputs this.board = board; this.renderer = renderer; this.winChecker = winChecker; this.inputProvider = inputProvider; this.outputProvider = outputProvider; // initialize the players list // set the game state to waiting to start }
private void Clear() { if (GameOverChecker != null) { GameOverChecker.Clear(); GameOverChecker = null; } if (WinChecker != null) { WinChecker.Clear(); WinChecker = null; } CellsField.Clear(); App.Instance.WindowManager.CloseAll(); }
public void Initialize(IGameOverChecker gameOverChecker, IWinChecker winChecker, Action onPauseButtonClick) { Clear(); _pauseButton.onClick.AddListener(() => { onPauseButtonClick(); }); _gameOverChecker = gameOverChecker; _gameOverChecker.OnRemainingValueChanged += OnLoseConditionCounterChange; OnLoseConditionCounterChange(_gameOverChecker.RemainingValue); _winChecker = winChecker; _winChecker.OnTargetsChange += OnTargetsChange; foreach (var targetItem in _winChecker.Targets) { var newTargetItem = Instantiate(_targetItemPrefab, _targetItemsContainer, false); newTargetItem.Initialize(targetItem); _targetItems.Add(newTargetItem); } }
public void SetWinner(IWinChecker winChecker) { _winChecker = winChecker; }
public Desk(int size) { Size = size; _deskFieldFactory = new ConsoleDeskFieldGenerator(); _winChecker = new SimpleWinChecker(); }
//Constructor for tests public SlotMachine(uint coins, ISlotsRandomizer slotsRandomizer) { _winChecker = new WinChecker(this); _slotsRandomizer = slotsRandomizer; Coins = coins; }
public SlotMachine(uint coins) { _slotsRandomizer = new SlotsRandomizer(); _winChecker = new WinChecker(this); Coins = coins; }
public UltimateTicTacToeCreationService(IWinChecker winChecker) { this.winChecker = winChecker; }
public TicTacToe(IWinChecker winChecker) { this.winChecker = winChecker; }