internal CheckersPiece(ePieceType i_PieceType, int[] i_Location) { m_PieceType = i_PieceType; r_PossibleSimpleMoves = new List <int[]>(); r_PossibleEatMoves = new List <int[]>(); m_Location = i_Location; }
public void SetImageInSquare(ePieceType i_BoardSquareType) { if (i_BoardSquareType.Equals(ePieceType.BlackPawn)) { this.m_PieceType = ePieceType.BlackPawn; this.Image = Resources.black_man; } else if (i_BoardSquareType.Equals(ePieceType.BlackKing)) { this.m_PieceType = ePieceType.BlackKing; this.Image = Resources.black_cro; } else if (i_BoardSquareType.Equals(ePieceType.WhitePawn)) { this.m_PieceType = ePieceType.WhitePawn; this.Image = Resources.white_man; } else if (i_BoardSquareType.Equals(ePieceType.WhiteKing)) { this.m_PieceType = ePieceType.WhiteKing; this.Image = Resources.white_cro; } else if (i_BoardSquareType.Equals(ePieceType.Empty)) { this.m_PieceType = ePieceType.Empty; if (this.Image != null) { this.Image.Dispose(); this.Image = null; } } }
protected async void HarvestClick(MouseEventArgs eventArgs) { if (!bOurTurn) { return; } if (bHarvest) { bHarvest = false; if (harvestList.Count() > 0) { var harvestCompanionList = new List <int>(); foreach (Piece piece in harvestList) { bHighlightState[piece.NPosition] = false; harvestIdList.Add(piece.NPosition + (nPlayer - 1) * 25 + 5); // check for companions for (int i = 0; i < 4; i++) { int pos = piece.NPosition + companion[i]; if (pos >= 0 && pos < 25) { Piece companionPiece = OurPieces.Find(p => p.NPosition == pos); if (companionPiece != null) { ePieceType companionType = companionPiece.GetPieceType(); if (companionPiece.GetPieceType() == ePieceType.pepper_red || companionPiece.GetPieceType() == ePieceType.pepper_yellow) { companionType = ePieceType.pepper_green; } if (companionType == piece.GetCompanionType()) { harvestCompanionList.Add(pos); } } } } } // filter companion list for distinct items var distinctCompanionSet = harvestCompanionList.Distinct(); // set bonus points for companions companionBonus = distinctCompanionSet.Count(); NotifyChange(new Status(nPlayer, true)); } } else { harvestList.Clear(); harvestIdList.Clear(); bHarvest = true; } StateHasChanged(); }
public BoardSquare(ePieceType i_PieceType, bool i_IsSquareActive, int i_SquareRow, int i_SquareCol) { this.Width = 50; this.Height = 50; this.r_SquareRow = i_SquareRow; this.r_SquareCol = i_SquareCol; this.BorderStyle = BorderStyle.Fixed3D; this.m_PieceType = i_PieceType; initializeBoardSquare(i_IsSquareActive); }
void AddVege(ePieceType pieceType, int count) { while (count > 0) { if (nVegeLeft == 90) { return; } vegeBag[nVegeLeft] = pieceType; count--; nVegeLeft++; } }
public Score(List <Piece> pieces) { if (pieces == null) { return; } piecesToScore = new List <CoOrdinate>(); foreach (Piece piece in pieces) { var pieceCoOrd = new CoOrdinate(piece.NPosition); piecesToScore.Add(pieceCoOrd); } Type = (ePieceType)pieces[0].NPieceType; }
public void SetKing() { m_Type = ePieceType.King; }
public Piece(ePlayerPosition i_PlayerPosition) { r_PlayerPosition = i_PlayerPosition; m_Type = ePieceType.Regular; }
public Score(List <CoOrdinate> pieces, ePieceType type) { Type = type; piecesToScore = pieces; }
public void SetPieceType(ePieceType type) { NPieceType = (int)type; }