Example #1
0
    private void CheckToMakeBombs()
    {
        if (FindMatches.instance.currentMatches.Count == 4 || FindMatches.instance.currentMatches.Count == 7)
        {
            FindMatches.instance.CheckBombs();
        }

        if (FindMatches.instance.currentMatches.Count == 5 || FindMatches.instance.currentMatches.Count == 8)
        {
            if (ColumnOrRow())
            {
                //make a color bomb
                if (currentDot != null)
                {
                    if (currentDot.isMatched)
                    {
                        if (!currentDot.isColorBomb)
                        {
                            currentDot.isMatched = false;
                            currentDot.MakeColorBomb();
                        }
                    }
                    else
                    {
                        if (currentDot.otherDot != null)
                        {
                            DotController otherDot = currentDot.otherDot.GetComponent <DotController>();
                            if (otherDot.isMatched)
                            {
                                if (!otherDot.isColorBomb)
                                {
                                    otherDot.isMatched = true;
                                    otherDot.MakeColorBomb();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                //make a adjacent bomb
                if (currentDot != null)
                {
                    if (currentDot.isMatched)
                    {
                        if (!currentDot.isAdjacentBomb)
                        {
                            currentDot.isMatched = false;
                            currentDot.MakeAdjacentBomb();
                        }
                    }
                    else
                    {
                        if (currentDot.otherDot != null)
                        {
                            DotController otherDot = currentDot.otherDot.GetComponent <DotController>();
                            if (otherDot.isMatched)
                            {
                                if (!otherDot.isAdjacentBomb)
                                {
                                    otherDot.isMatched = true;
                                    otherDot.MakeAdjacentBomb();
                                }
                            }
                        }
                    }
                }
            }
        }
    }