Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
    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);
    }
Ejemplo n.º 4
0
    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]);
            }
        }
    }