Exemplo n.º 1
0
    void CheckToMakeBombs()
    {
        //How many objects are in findMatches currentMatches?
        if (matchFinder.currentMatches.Count > 3)
        {
            //What type of match?
            MatchType typeOfMatch = ColumnOrRow();
            if (typeOfMatch.type == 1)
            {
                //Make a color bomb
                //is the current dot matched?
                if (currentDot != null && currentDot.isMatched && currentDot.tag == typeOfMatch.color)
                {
                    currentDot.isMatched = false;
                    currentDot.MakeColorBomb();
                }
                else
                {
                    if (currentDot.otherDot != null)
                    {
                        Dots otherDot = currentDot.otherDot.GetComponent <Dots>();
                        if (otherDot.isMatched && otherDot.tag == typeOfMatch.color)
                        {
                            otherDot.isMatched = false;
                            otherDot.MakeColorBomb();
                        }
                    }
                }
            }

            else if (typeOfMatch.type == 2)
            {
                //Make a adjacent bomb
                //is the current dot matched?
                if (currentDot != null && currentDot.isMatched && currentDot.tag == typeOfMatch.color)
                {
                    currentDot.isMatched = false;
                    currentDot.MakeAdjacentBomb();
                }
                else if (currentDot.otherDot != null)
                {
                    Dots otherDot = currentDot.otherDot.GetComponent <Dots>();
                    if (otherDot.isMatched && otherDot.tag == typeOfMatch.color)
                    {
                        otherDot.isMatched = false;
                        otherDot.MakeAdjacentBomb();
                    }
                }
            }
            else if (typeOfMatch.type == 3)
            {
                matchFinder.CheckBombs(typeOfMatch);
            }
        }
    }
Exemplo n.º 2
0
    } //3.1

    private void MakingBombs() //belirlenen bomba cesidine gore bombayi olusturuyor
    {
        if (find.matches.Count > 3)
        {
            int theBomb = BombType();

            if (theBomb == 1)
            {
                if (currentDot != null)
                {
                    if (currentDot.isMatched == true)
                    {
                        if (currentDot.isColorBomb == false)
                        {
                            currentDot.isMatched = false;
                            currentDot.MakeColorBomb();
                        }
                    }
                    else
                    {
                        if (currentDot.otherDot != null)
                        {
                            Dots otherDot = currentDot.otherDot.GetComponent <Dots>();
                            if (otherDot.isMatched == true)
                            {
                                if (otherDot.isColorBomb == false)
                                {
                                    otherDot.isMatched = false;
                                    otherDot.MakeColorBomb();
                                }
                            }
                        }
                    }
                }
            }  //makeColorBomb
            else if (theBomb == 2)
            {
                if (currentDot != null)
                {
                    if (currentDot.isMatched == true)
                    {
                        if (currentDot.isBigBomb == false)
                        {
                            currentDot.isMatched = false;
                            currentDot.MakeBigBomb();
                        }
                    }
                    else
                    {
                        if (currentDot.otherDot != null)
                        {
                            Dots otherDot = currentDot.otherDot.GetComponent <Dots>();
                            if (otherDot.isMatched == true)
                            {
                                if (otherDot.isBigBomb == false)
                                {
                                    otherDot.isMatched = false;
                                    otherDot.MakeBigBomb();
                                }
                            }
                        }
                    }
                }
            } //makeBigBomb
            else if (theBomb == 3)
            {
                find.CheckBombs();
            } //make row or colum bomb
        }
    }         //3.2