Exemplo n.º 1
0
    private void CheckAndUpdateTopRightSpike()
    {
        Spike currentSpike    = attachedHackCard.GetTopRightSpike();
        Spike rightSpike      = rightSquare.GetTopLeftSpike();
        Spike aboveRightSpike = aboveRightDiagonalSquare.GetBottomLeftSpike();
        Spike aboveSpike      = aboveSquare.GetBottomRightSpike();

        string color = currentSpike.GetSpikeColor();

        if (rightSpike && aboveSpike && aboveRightSpike && color == rightSpike.GetSpikeColor() && color == aboveSpike.GetSpikeColor() && color == aboveRightSpike.GetSpikeColor())
        {
            // ALL FOUR CONNECTED
            currentSpike.SetState("two");
            aboveSpike.SetState("two");
            rightSpike.SetState("two");
            aboveRightSpike.SetState("two");
            UpdatePoints(color, 4);
        }
        else if (rightSpike && aboveRightSpike && color == rightSpike.GetSpikeColor() && color == aboveRightSpike.GetSpikeColor())
        {
            // RIGHT, DIAGONAL
            currentSpike.SetState("right");
            rightSpike.SetState("two");
            aboveRightSpike.SetState("down");
            UpdatePoints(color, 3);
        }
        else if (aboveSpike && aboveRightSpike && color == aboveSpike.GetSpikeColor() && color == aboveRightSpike.GetSpikeColor())
        {
            // UP DIAGONAL
            currentSpike.SetState("up");
            aboveSpike.SetState("two");
            aboveRightSpike.SetState("left");
            UpdatePoints(color, 3);
        }
        else if (rightSpike && aboveSpike && color == rightSpike.GetSpikeColor() && color == aboveSpike.GetSpikeColor())
        {
            // RIGHT UP
            currentSpike.SetState("two");
            rightSpike.SetState("left");
            aboveSpike.SetState("down");
            UpdatePoints(color, 3);
        }
        else if (rightSpike && color == rightSpike.GetSpikeColor())
        {
            // RIGHT
            currentSpike.SetState("right");
            rightSpike.SetState("left");
            UpdatePoints(color, 2);
        }
        else if (aboveSpike && color == aboveSpike.GetSpikeColor())
        {
            // UP
            currentSpike.SetState("up");
            aboveSpike.SetState("down");
            UpdatePoints(color, 2);
        }
        else
        {
            // NONE
            currentSpike.SetState("closed");
        }

        currentSpike.SetSpikeImage("topright");
        if (aboveSpike)
        {
            aboveSpike.SetSpikeImage("bottomright");
        }
        if (aboveRightSpike)
        {
            aboveRightSpike.SetSpikeImage("bottomleft");
        }
        if (rightSpike)
        {
            rightSpike.SetSpikeImage("topleft");
        }
    }
Exemplo n.º 2
0
    private void CheckAndUpdateBottomLeftSpike()
    {
        Spike currentSpike   = attachedHackCard.GetBottomLeftSpike();
        Spike leftSpike      = leftSquare.GetBottomRightSpike();
        Spike belowLeftSpike = belowLeftDiagonalSquare.GetTopRightSpike();
        Spike belowSpike     = belowSquare.GetTopLeftSpike();

        string color = currentSpike.GetSpikeColor();

        if (leftSpike && belowSpike && belowLeftSpike && color == leftSpike.GetSpikeColor() && color == belowSpike.GetSpikeColor() && color == belowLeftSpike.GetSpikeColor())
        {
            // ALL FOUR CONNECTED
            currentSpike.SetState("two");
            belowSpike.SetState("two");
            leftSpike.SetState("two");
            belowLeftSpike.SetState("two");
            UpdatePoints(color, 4);
        }
        else if (leftSpike && belowLeftSpike && color == leftSpike.GetSpikeColor() && color == belowLeftSpike.GetSpikeColor())
        {
            // LEFT, DIAGONAL
            currentSpike.SetState("left");
            leftSpike.SetState("two");
            belowLeftSpike.SetState("up");
            UpdatePoints(color, 3);
        }
        else if (belowSpike && belowLeftSpike && color == belowSpike.GetSpikeColor() && color == belowLeftSpike.GetSpikeColor())
        {
            // DOWN DIAGONAL
            currentSpike.SetState("down");
            belowSpike.SetState("two");
            belowLeftSpike.SetState("right");
            UpdatePoints(color, 3);
        }
        else if (leftSpike && belowSpike && color == leftSpike.GetSpikeColor() && color == belowSpike.GetSpikeColor())
        {
            // LEFT DOWN
            currentSpike.SetState("two");
            leftSpike.SetState("right");
            belowSpike.SetState("up");
            UpdatePoints(color, 3);
        }
        else if (leftSpike && color == leftSpike.GetSpikeColor())
        {
            // LEFT
            currentSpike.SetState("left");
            leftSpike.SetState("right");
            UpdatePoints(color, 2);
        }
        else if (belowSpike && color == belowSpike.GetSpikeColor())
        {
            // UP
            currentSpike.SetState("down");
            belowSpike.SetState("up");
            UpdatePoints(color, 2);
        }
        else
        {
            // NONE
            currentSpike.SetState("closed");
        }

        currentSpike.SetSpikeImage("bottomleft");
        if (belowSpike)
        {
            belowSpike.SetSpikeImage("topleft");
        }
        if (belowLeftSpike)
        {
            belowLeftSpike.SetSpikeImage("topright");
        }
        if (leftSpike)
        {
            leftSpike.SetSpikeImage("bottomright");
        }
    }