/// <summary> /// Stop be queen /// </summary> public void UnBeQueen() { CheckerImpl = new SimpleChImpl(PlayerMoveDirection) { Cell = CheckerImpl.Cell }; CheckerGraphicalImplementation.UnBeQueen(); }
/// <summary> /// Start be queen /// </summary> public void BeQueen() { CheckerImpl = new QueenChImpl(PlayerMoveDirection) { Cell = CheckerImpl.Cell }; CheckerGraphicalImplementation?.BeQueen(); }
/// <summary> /// Make checker unselected /// </summary> public void Unselect() { CheckerGraphicalImplementation.ChancheBgColor(Color.Transparent); foreach (Move move in AllowedMoves) { move.ToCell.ChangeBgColor(Color.Gray); move.ToCell.Click -= move.Do; move.ToCell.Click -= move.AddSelfToGameMoveList; } GameDataHandler.Selected = null; }
/// <summary> /// Make checker selected /// </summary> private void Select() { CheckerGraphicalImplementation.ChancheBgColor(Color.Khaki); foreach (Move move in AllowedMoves) { move.ToCell.ChangeBgColor(Color.BlueViolet); move.ToCell.Click += move.Do; move.ToCell.Click += move.AddSelfToGameMoveList; } GameDataHandler.Selected = this; }
/// <summary> /// Constructor of checker /// </summary> /// <param name="cell">Cell, where the checker located</param> /// <param name="playerMoveDirection">Direction of moves</param> /// <param name="graphicalImplementation">Graphical implementation of checker</param> protected Checker(Cell cell, PlayerMoveDirection playerMoveDirection, CheckerGraphicalImplementation graphicalImplementation) { if (graphicalImplementation != null) { CheckerGraphicalImplementation = graphicalImplementation; CheckerGraphicalImplementation.SpriteClick += CheckerClick; CheckerGraphicalImplementation.SpriteClick += () => Click?.Invoke(); } CheckerImpl = new SimpleChImpl(playerMoveDirection); Cell = cell; // cell.Checker = this; }
private CheckerGraphicalImplementation[,,] GenerateArrayCheckerImplementations() { CheckerGraphicalImplementation[,,] windowsCheckerImplementations = new CheckerGraphicalImplementation[2, 3, 4]; for (int k = 0; k < 2; k++) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 4; j++) { windowsCheckerImplementations[k, i, j] = new WhinowsCheckerImplementation(); } } } return(windowsCheckerImplementations); }
/// <summary> /// Draw checker on field /// </summary> /// <param name="color"></param> /// <param name="cell"></param> protected void Draw(Color color, Cell cell) { CheckerGraphicalImplementation?.Draw(color, cell); }
/// <summary> /// Get checker image /// </summary> /// <returns></returns> public Object GetImage() { return(CheckerGraphicalImplementation.GetImage()); }
public BlackChecker(Cell cell, PlayerMoveDirection playerMoveDirection, CheckerGraphicalImplementation checkerGraphical) : base(cell, playerMoveDirection, checkerGraphical) { Draw(Color.Black, cell); }