public static bool IsEnemy(Piece piece1, Piece piece2) { GCPlayer p1 = GameManager.Instance.P1; if (p1.Has(piece1) && !p1.Has(piece2)) { return(true); } if (p1.Has(piece2) && !p1.Has(piece1)) { return(true); } return(false); }
public override void ComputeBound() { Node currNode = piece.Node; int origRow = currNode.row; int origCol = currNode.col; Node frontNode = null; Node leftEatNode = null; Node rightEatNode = null; Grid grid = GameManager.Instance.Grid; GCPlayer p1 = p1 = GameManager.Instance.P1; int toAdd = 0; if (p1.Has(piece)) { toAdd = 1; } else { toAdd = -1; } frontNode = grid.GetNodeAt(origRow + toAdd, origCol); leftEatNode = grid.GetNodeAt(origRow + toAdd, origCol - 1); rightEatNode = grid.GetNodeAt(origRow + toAdd, origCol + 1); ComputeMoveOrEatPiece(leftEatNode); ComputeMoveOrEatPiece(rightEatNode); ComputeMoveOrEatPiece(frontNode); }
public static bool IsAlly(Piece piece1, Piece piece2) { GCPlayer p1 = GameManager.Instance.P1; if (p1.Has(piece1) && p1.Has(piece2)) { return(true); } GCPlayer p2 = GameManager.Instance.P2; if (p2.Has(piece1) && p2.Has(piece2)) { return(true); } return(false); }
public override void ComputeBound() { Node currNode = piece.Node; int origRow = currNode.row; int origCol = currNode.col; Node frontNode = null; Node leftEatNode = null; Node rightEatNode = null; int toAdd = 0; if (p1.Has(piece)) { toAdd = 1; } else { toAdd = -1; } frontNode = grid.GetNodeAt(origRow + toAdd, origCol); leftEatNode = grid.GetNodeAt(origRow + toAdd, origCol - 1); rightEatNode = grid.GetNodeAt(origRow + toAdd, origCol + 1); ComputeEatPiece(leftEatNode); ComputeEatPiece(rightEatNode); ComputeMovePiece(frontNode); if (!moved && !didSpecialMove) { if (frontNode.EmptySpace) { specialNodes[0] = frontNode; specialNodes[1] = grid.GetNodeAt(origRow + toAdd * 2, origCol); ComputeMovePiece(specialNodes[1]); } } }