Example #1
0
    protected bool CheckLock()
    {
        int count = 0;

        if (square1 != null)
        {
            count += MatchColor(script1.GetColor(Translate(Directions[0])));
        }
        if (square2 != null)
        {
            count += MatchColor(script2.GetColor(Translate(Directions[1])));
        }
        if (square3 != null)
        {
            count += MatchColor(script3.GetColor(Translate(Directions[2])));
        }
        if (square4 != null)
        {
            count += MatchColor(script4.GetColor(Translate(Directions[3])));
        }
        if (square5 != null)
        {
            count += MatchColor(script5.GetColor(Translate(Directions[4])));
        }
        if (square6 != null)
        {
            count += MatchColor(script6.GetColor(Translate(Directions[5])));
        }
        if (square7 != null)
        {
            count += MatchColor(script7.GetColor(Translate(Directions[6])));
        }
        if (square8 != null)
        {
            count += MatchColor(script8.GetColor(Translate(Directions[7])));
        }

        if (count >= amount)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }