예제 #1
0
        public BlackChecker CreateBlackPhantom(Coord coord, IGameField gameField)
        {
            BlackChecker black = new BlackChecker(new BlackNormalCheckerState(), null);

            black.CurrentCoord = coord;
            return(black);
        }
예제 #2
0
        public BlackChecker CreateBlack(Coord coord, IGameField gameField)
        {
            BlackChecker black = new BlackChecker(new BlackNormalCheckerState(), new CheckerUI());

            black.CurrentCoord = coord;
            (black.checkerUI as CheckerUI).AssignConnectedChecker(black);

            CheckerUI checkerUI = black.checkerUI as CheckerUI;

            checkerUI.CoordChangedFromForm         += black.CoordChangedFromForm;
            black.CoordChanged                     += gameField.CheckCheckersMovement;
            gameField.Grid[coord.Row][coord.Column] = black;
            Grid.SetColumn(black.checkerUI, coord.Column - 1);
            Grid.SetRow(black.checkerUI, coord.Row - 1);
            gameField.FormGrid.Children.Add(black.checkerUI);
            checkerUI.TryingToMoveToAnotherCell += gameField.MainWindow.TryToMoveCheckerToAnotherCell;
            checkerUI.MovingToAnotherCell       += gameField.MainWindow.MoveCheckerToAnotherCell;
            checkerUI.ConnectedChecker           = black;
            checkerUI.GetVictim += gameField.GetVictim;
            return(black);
        }