示例#1
0
    void OnTouchEnd()
    {
        // score the dots in our dot list
        if (dotSquare.SquareExists(currentDotLink))
        {
            dotSquare.Score();
        }
        else
        {
            List <BoardSpace> connectionSpaces = currentDotLink.GetConnectionSpaces();
            if (connectionSpaces.Count > 1)
            {
                for (int i = 0; i < connectionSpaces.Count; i++)
                {
                    connectionSpaces[i].SetEmpty(true);
                    connectionSpaces[i].GetCurrentDot().Score();
                }
            }
        }

        dotSquare.Reset();
        currentDotLink.Reset();
        touchLine.Remove();

        // drop the dots
        board.DropDots();
    }
示例#2
0
    // Determine if the given dot link contains a square
    public bool SquareExists(CurrentDotLink dotLink)
    {
        List <BoardSpace> linkSpaces = dotLink.GetConnectionSpaces();

        for (int i = 0; i < linkSpaces.Count; i++)
        {
            List <BoardSpace> linkSpaceConnections = linkSpaces[i].GetConnectedSpaces();
            for (int k = 0; k < linkSpaceConnections.Count; k++)
            {
                if (connectedSpaces.Contains(linkSpaceConnections[k]))
                {
                    return(true);
                }
                connectedSpaces.Add(linkSpaceConnections[k]);
            }
        }
        return(false);
    }