示例#1
0
    // Attempt to add the given space to the current dot link
    public void AddSpace(BoardSpace space)
    {
        // already connected, don't allow
        if (ConnectionExists(space))
        {
            return;
        }

        previousConnected = lastConnected;
        lastConnected     = space;

        // the link's type matches the first dot added
        if (IsEmpty())
        {
            dotType = space.GetCurrentDot().GetDotType();
        }

        // add the dot
        currentConnectedSpaces.Add(space);
        space.GetCurrentDot().Select();

        // connect last spaces with the line
        if (currentConnectedSpaces.Count >= 2)
        {
            previousConnected.Connect(lastConnected);
        }
    }