Пример #1
0
    private void CheckAndUpdateTopLeftSpike()
    {
        Spike currentSpike   = attachedHackCard.GetTopLeftSpike();
        Spike leftSpike      = leftSquare.GetTopRightSpike();
        Spike aboveLeftSpike = aboveLeftDiagonalSquare.GetBottomRightSpike();
        Spike aboveSpike     = aboveSquare.GetBottomLeftSpike();

        string color = currentSpike.GetSpikeColor();

        if (leftSpike && aboveSpike && aboveLeftSpike && color == leftSpike.GetSpikeColor() && color == aboveSpike.GetSpikeColor() && color == aboveLeftSpike.GetSpikeColor())
        {
            // ALL FOUR CONNECTED
            currentSpike.SetState("two");
            aboveSpike.SetState("two");
            leftSpike.SetState("two");
            aboveLeftSpike.SetState("two");
            UpdatePoints(color, 4);
        }
        else if (leftSpike && aboveLeftSpike && color == leftSpike.GetSpikeColor() && color == aboveLeftSpike.GetSpikeColor())
        {
            // LEFT, DIAGONAL
            currentSpike.SetState("left");
            leftSpike.SetState("two");
            aboveLeftSpike.SetState("down");
            UpdatePoints(color, 3);
        }
        else if (aboveSpike && aboveLeftSpike && color == aboveSpike.GetSpikeColor() && color == aboveLeftSpike.GetSpikeColor())
        {
            // UP DIAGONAL
            currentSpike.SetState("up");
            aboveSpike.SetState("two");
            aboveLeftSpike.SetState("right");
            UpdatePoints(color, 3);
        }
        else if (leftSpike && aboveSpike && color == leftSpike.GetSpikeColor() && color == aboveSpike.GetSpikeColor())
        {
            // LEFT UP
            currentSpike.SetState("two");
            leftSpike.SetState("right");
            aboveSpike.SetState("down");
            UpdatePoints(color, 3);
        }
        else if (leftSpike && color == leftSpike.GetSpikeColor())
        {
            // LEFT
            currentSpike.SetState("left");
            leftSpike.SetState("right");
            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("topleft");
        if (aboveSpike)
        {
            aboveSpike.SetSpikeImage("bottomleft");
        }
        if (aboveLeftSpike)
        {
            aboveLeftSpike.SetSpikeImage("bottomright");
        }
        if (leftSpike)
        {
            leftSpike.SetSpikeImage("topright");
        }
    }
Пример #2
0
    private void CheckAndUpdateBottomRightSpike()
    {
        Spike currentSpike    = attachedHackCard.GetbottomRightSpike();
        Spike rightSpike      = rightSquare.GetBottomLeftSpike();
        Spike belowRightSpike = belowRightDiagonalSquare.GetTopLeftSpike();
        Spike belowSpike      = belowSquare.GetTopRightSpike();

        string color = currentSpike.GetSpikeColor();

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

        currentSpike.SetSpikeImage("bottomright");
        if (belowSpike)
        {
            belowSpike.SetSpikeImage("topright");
        }
        if (belowRightSpike)
        {
            belowRightSpike.SetSpikeImage("topleft");
        }
        if (rightSpike)
        {
            rightSpike.SetSpikeImage("bottomleft");
        }
    }