예제 #1
0
    private bool isValidMove(IntVector2 _testPoint, LineClass _lineIn, bool checkUsedArray)
    {
        IntVector2 testPointReverse = _lineIn.getReverse(_testPoint);

        if (isOutsideGameGrid(_testPoint))
        {
            return(false);
        }
        if (isOutsideGameGrid(testPointReverse))
        {
            return(false);
        }

        if (isSquareABlocker(_testPoint))
        {
            return(false);
        }
        if (isSquareABlocker(testPointReverse))
        {
            return(false);
        }


        if (!_lineIn.isValidMove(_testPoint))
        {
            return(false);
        }


        if (checkUsedArray)
        {
            if (usedArray [_testPoint.x, _testPoint.y])
            {
                return(false);
            }
            if (usedArray [testPointReverse.x, testPointReverse.y])
            {
                return(false);
            }
        }
        else
        {
            for (int i = 0; i < linesList.Count; ++i)
            {
                if (i != activeLine)
                {
                    if (linesList [i].hitsLine(_testPoint))
                    {
                        return(false);
                    }
                    if (linesList [i].hitsLine(testPointReverse))
                    {
                        return(false);
                    }
                }
            }
        }
        return(true);
    }