Beispiel #1
0
    private bool DestroyMatchesAt(int column, int row)
    {
        AnimalTile testAnimal = allAnimals[column, row].GetComponent <AnimalTile>();

        if (testAnimal.isMatched)
        {
            //how many elements are in the matched pieces list
            if (findMatches.currentMatches.Count == 4 && currentAnimal != null && !(testAnimal.isColumnBomb || testAnimal.isRowBomb))
            {
                if (findMatches.CheckBombs())
                {
                    findMatches.formedBombs.Add(currentAnimal);
                }
            }
            findMatches.currentMatches.Remove(allAnimals[column, row]);
            GameObject explode = Instantiate(explosion, allAnimals[column, row].transform.position, Quaternion.identity);
            Destroy(explode, 1f);
            if (testAnimal.isMatched)
            {
                Destroy(allAnimals[column, row]);
                allAnimals[column, row] = null;
            }
            return(true);
        }
        else if (findMatches.formedBombs.Contains(testAnimal))
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Beispiel #2
0
 private void CheckToMakeBombs()
 {
     //How many objects are in findMatches currentMatches
     if (findMatches.currentMatches.Count > 3)
     {
         matchType = ColumnOrRow();
         if (matchType.type == "color")
         {
             MakeColorBomb();
         }
         else if (matchType.type == "adjacent")
         {
             MakeAdjacentBomb();
         }
         else if (matchType.type == "column or row")
         {
             // if(currentMatches != null) {
             //     findMatches.CheckBombs(matchType);
             // } else {
             //     //Make column bomb as piece is falling down
             //     //the piece that falls into should be the column bomb
             // }
             findMatches.CheckBombs(matchType);
         }
     }
 }
Beispiel #3
0
    private void CheckToMakeBombs() // Делаем бомбы по ко-ву совпавших кружков
    {
        //сколько объектов в поиске соответствует текущему соответствию

        if (findMatches.currentMatches.Count > 3)
        {
            //какой тип совпадения?

            MatchType typeOfMatch = ColumnOrRow();

            if (typeOfMatch.type == 1) // делаем цветную бомбу
            {
                //сделать цветную бомбу
                //текущая точка соответствует?
                if (currentCircle != null && currentCircle.isMatched && currentCircle.tag == typeOfMatch.color)
                {
                    currentCircle.isMatched = false;
                    currentCircle.MakeColorBomb();
                }
                else
                {
                    if (currentCircle.otherCircle != null)
                    {
                        Circle otherCircle = currentCircle.otherCircle.GetComponent <Circle>();
                        if (otherCircle.isMatched && otherCircle.tag == typeOfMatch.color)
                        {
                            otherCircle.isMatched = false;
                            otherCircle.MakeColorBomb();
                        }
                    }
                }
            }

            else if (typeOfMatch.type == 2) // бомба для соседних кругов
            {
                //сделать для соседних кругов бомбу
                //текущая точка соответствует?
                if (currentCircle != null && currentCircle.isMatched && currentCircle.tag == typeOfMatch.color)
                {
                    currentCircle.isMatched = false;
                    currentCircle.MakeAdjacentBomb();
                }

                else if (currentCircle.otherCircle != null)
                {
                    Circle otherCircle = currentCircle.otherCircle.GetComponent <Circle>();
                    if (otherCircle.isMatched && otherCircle.tag == typeOfMatch.color)
                    {
                        otherCircle.isMatched = false;
                        otherCircle.MakeAdjacentBomb();
                    }
                }
            }
            else if (typeOfMatch.type == 3) //строчная и колонная бомбы
            {
                findMatches.CheckBombs(typeOfMatch);
            }
        }
    }
Beispiel #4
0
    private void CheckToMakeBombs()
    {
        //How many objects are in findMatches currentMatches?
        if (findMatches.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)
                    {
                        Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                        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)
                {
                    Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                    if (otherDot.isMatched && otherDot.tag == typeOfMatch.color)
                    {
                        otherDot.isMatched = false;
                        otherDot.MakeAdjacentBomb();
                    }
                }
            }
            else if (typeOfMatch.type == 3)
            {
                findMatches.CheckBombs(typeOfMatch);
            }
        }
    }
Beispiel #5
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allTiles[column, row].GetComponent <Tile>().isMatched)
        {
            //ow many elements are in the matched pieces from findmatches?
            if (findMatches.CurrentMatches.Count == 4 || findMatches.CurrentMatches.Count == 7)
            {
                findMatches.CheckBombs(BombType.DIRECTIONAL);
            }
            if (findMatches.CurrentMatches.Count == 5)
            {
                //Setup Color Bombs();
                findMatches.CheckBombs(BombType.COLOR);
            }

            GameObject particle = Instantiate(destroyEffect, allTiles[column, row].transform.position, Quaternion.identity);
            Destroy(particle, 0.5f);
            Destroy(allTiles[column, row]);
            allTiles[column, row] = null;
        }
    }
Beispiel #6
0
 private void DestroyMatchesAt(int column, int row)
 {
     if (allDots[column, row].GetComponent <Dot>().isMatched)
     {
         //how many elements are in the matched pieces list
         if (findMatches.currentMatches.Count == 4 || findMatches.currentMatches.Count == 7)
         {
             findMatches.CheckBombs();
         }
         GameObject particle = Instantiate(DestroyEffect, allDots[column, row].transform.position, Quaternion.identity);
         Destroy(particle, .5f);
         Destroy(allDots[column, row]);
         findMatches.currentMatches.Remove(allDots[column, row]);
         allDots[column, row] = null;
     }
 }
Beispiel #7
0
 // Destroi objetos que estiverem "matched" em uma posicao especifica (coluna, linha).
 private void DestroyMatchesAt(int coluna, int linha)
 {
     if (allDots[coluna, linha].GetComponent <Dot>().isMatched)
     {
         //Quantos elementos estao na lista de Matched
         if (findMatches.currentMatches.Count == 4 || findMatches.currentMatches.Count == 7)
         {
             findMatches.CheckBombs();
         }
         findMatches.currentMatches.Remove(allDots[coluna, linha]);
         GameObject particle = Instantiate(destroyEffect, allDots[coluna, linha].transform.position, Quaternion.identity);
         Destroy(particle, .6f);
         Destroy(allDots[coluna, linha]);
         allDots[coluna, linha] = null;
     }
 }
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            //How many elements are in the matched pieces list from findmatches?
            if (findMatches.currentMatches.Count == 4 || findMatches.currentMatches.Count == 7)
            {
                findMatches.CheckBombs();
            }

            GameObject particle = Instantiate(destroyParticle,
                                              allDots[column, row].transform.position,
                                              Quaternion.identity);
            Destroy(particle, .5f);
            Destroy(allDots[column, row]);
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allDots[column, row] = null;
        }
    }
Beispiel #9
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            //How many elements are in the matched pieces list from findmatches?
            if (findMatches.currentMatches.Count == 4 || findMatches.currentMatches.Count == 7)
            {
                findMatches.CheckBombs();
            }

            GameObject particle = Instantiate(destroyParticle,
                                              allDots[column, row].transform.position,
                                              Quaternion.identity);
            Destroy(particle, .5f);
            Destroy(allDots[column, row]);
            allDots[column, row] = null;
            score++;
            scoreText.GetComponent <Text>().text = "Score:" + score.ToString();
        }
    }
Beispiel #10
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (!allDots[column, row].GetComponent <Dot>().isMatched)
        {
            return;
        }
        //How many elements are in the matched pieces list from find matches?
        if (findMatches.CurrentMatches.Count == 4 || findMatches.CurrentMatches.Count == 7)
        {
            findMatches.CheckBombs();
        }

        var particle = Instantiate(destroyParticle,
                                   allDots[column, row].transform.position,
                                   Quaternion.identity);

        Destroy(particle, .5f);
        Destroy(allDots[column, row]);
        allDots[column, row] = null;
    }
Beispiel #11
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            //How many elements are in the matched pieces list from findmatches?
            if (findMatches.currentMatches.Count == 4 || findMatches.currentMatches.Count == 7)
            {
                findMatches.CheckBombs();
            }
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }

            GameObject particle = Instantiate(destroyParticle,
                                              allDots[column, row].transform.position,
                                              Quaternion.identity);
            Destroy(particle, .5f);
            Destroy(allDots[column, row]);
            allDots[column, row] = null;
        }
    }
Beispiel #12
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
Beispiel #13
0
    private void CheckToMakeBombs()
    {
        if (findMatches.currentMatches.Count >= 4 || findMatches.currentMatches.Count >= 7 || findMatches.currentMatches.Count >= 5)
        {
            // 가로의 매칭 확인
            int numberHorizontal = 0;
            // 세로의 매칭 확인
            int numberVertical = 0;

            Dot firstPiece = findMatches.currentMatches[0].GetComponent <Dot>();

            if (firstPiece != null)
            {
                foreach (GameObject currentPiece in findMatches.currentMatches)
                {
                    Dot dot = currentPiece.GetComponent <Dot>();
                    // 처음 블럭 기준으로 y좌표가 같다면
                    if (dot.row == firstPiece.row)
                    {
                        numberHorizontal++;
                    }
                    // 처음블럭 기준으로 x좌표가 같다면
                    if (dot.column == firstPiece.column)
                    {
                        numberVertical++;
                    }
                }
            }
            // 2 * 2 의 매칭을 확인
            if (numberHorizontal >= 2 && numberVertical >= 2)
            {
                if (currentDot != null)
                {
                    // 사용자가 직접 움직인 블럭에의한 매칭인가?
                    if (currentDot.isMatched)
                    {
                        if (!currentDot.isMunchkinBomb)
                        {
                            currentDot.isMatched = false;
                            currentDot.MakeMunchkinBomb();
                        }
                    }
                    // 직접 움직이지 않은 블럭이 스와이프되어 매칭이 성립되는가?
                    else
                    {
                        if (currentDot.otherDot != null)
                        {
                            Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                            if (otherDot.isMatched)
                            {
                                if (!otherDot.isMunchkinBomb)
                                {
                                    otherDot.isMatched = false;
                                    otherDot.MakeMunchkinBomb();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                // 일렬로 4개의 매칭을 확인
                findMatches.CheckBombs();
            }
        }

        // 여러 특수 블럭이 있어서 2*2 매칭의 확인이 모호해질때가 있습니다. 주석을 해제하시면 나란한 5개의 매칭과 ㄱ, ㄴ T 형태의 매칭을 확인할 수 있습니다.

        /* else if(findMatches.currentMatches.Count == 5 || findMatches.currentMatches.Count == 8)
         * {
         *  // 나란한 5개의 매칭
         *  if(ColumnOrRow())
         *  {
         *
         *      if(currentDot != null)
         *      {
         *          // 사용자가 직접 움직인 블럭에의한 매칭인가?
         *          if(currentDot.isMatched)
         *          {
         *              if(!currentDot.isColorBomb)
         *              {
         *                  currentDot.isMatched = false;
         *                  currentDot.MakeColorBomb();
         *              }
         *          }
         *          // 직접 움직이지 않은 블럭이 스와이프되어 매칭이 성립되는가?
         *          else
         *          {
         *              if(currentDot.otherDot != null)
         *              {
         *                  Dot otherDot = currentDot.otherDot.GetComponent<Dot>();
         *                  if(otherDot.isMatched)
         *                  {
         *                      if(!otherDot.isColorBomb)
         *                      {
         *                          otherDot.isMatched = false;
         *                          otherDot.MakeColorBomb();
         *                      }
         *                  }
         *              }
         *          }
         *      }
         *  }
         *  //  T자 혹은 ㄱ자 가 되는 5개의 매칭
         *  else
         *  {
         *      if (currentDot != null)
         *      {
         *          // 사용자가 직접 움직인 블럭에의한 매칭인가?
         *          if (currentDot.isMatched)
         *          {
         *              if (!currentDot.isAdjacentBomb)
         *              {
         *                  currentDot.isMatched = false;
         *                  currentDot.MakeAdjacentBomb();
         *                  currentDot.ChangeColorToOriginalColor();
         *              }
         *          }
         *          // 직접 움직이지 않은 블럭이 스와이프되어 매칭이 성립되는가?
         *          else
         *          {
         *              if (currentDot.otherDot != null)
         *              {
         *                  Dot otherDot = currentDot.otherDot.GetComponent<Dot>();
         *                  if (otherDot.isMatched)
         *                  {
         *                      if (!otherDot.isAdjacentBomb)
         *                      {
         *                          otherDot.isMatched = false;
         *                          otherDot.MakeAdjacentBomb();
         *                          currentDot.ChangeColorToOriginalColor();
         *                      }
         *                  }
         *              }
         *          }
         *      }
         *  }
         * }*/
    }
Beispiel #14
0
    private void CheckToMakeBombs()
    {
        if (findMatches.currentMatches.Count == 4 ||
            findMatches.currentMatches.Count == 7)
        {
            findMatches.CheckBombs();
        }

        if (findMatches.currentMatches.Count == 5 ||
            findMatches.currentMatches.Count == 8)
        {
            if (ColumnOrRow())
            {
                //Make a color bomb
                //Debug.Log("Make a color bomb");
                //is the current dot matched?
                if (null != currentDot)
                {
                    if (currentDot.isMatched)
                    {
                        if (false == currentDot.isColorBomb)
                        {
                            currentDot.isMatched = false;
                            currentDot.MakeColorBomb();
                        }
                    }
                    else
                    {
                        if (null != currentDot.otherDot)
                        {
                            Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                            if (otherDot.isMatched)
                            {
                                if (false == otherDot.isColorBomb)
                                {
                                    otherDot.isMatched = false;
                                    otherDot.MakeColorBomb();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                //Make an adjacent bomb
                //Debug.Log("Make an adjacent bomb");
                if (null != currentDot)
                {
                    if (currentDot.isMatched)
                    {
                        if (false == currentDot.isAdjacentBomb)
                        {
                            currentDot.isMatched = false;
                            currentDot.MakeAdjacentBomb();
                        }
                    }
                    else
                    {
                        if (null != currentDot.otherDot)
                        {
                            Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                            if (otherDot.isMatched)
                            {
                                if (false == otherDot.isAdjacentBomb)
                                {
                                    otherDot.isMatched = false;
                                    otherDot.MakeAdjacentBomb();
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Beispiel #15
0
        private void CheckToMakeBombs()
        {
            var matchesCount = findMatches.currentMatches.Count;

            if (matchesCount == 4 || matchesCount == 7)
            {
                findMatches.CheckBombs();
            }

            if (matchesCount == 5 || matchesCount == 6)
            {
                if (ColumnOrRow())
                {
                    //make a color bomb
                    if (currentElement != null)
                    {
                        if (currentElement.isMatched)
                        {
                            if (!currentElement.isColorBomb)
                            {
                                currentElement.isMatched = false;
                                currentElement.MakeColorBomb();
                            }
                        }
                        else
                        {
                            if (currentElement.nextDot != null)
                            {
                                var nextDot = currentElement.nextDot.GetComponent <Element>();
                                if (nextDot.isMatched)
                                {
                                    if (!nextDot.isColorBomb)
                                    {
                                        nextDot.isMatched = false;
                                        nextDot.MakeColorBomb();
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    //make a adjacent bomb
                    if (currentElement != null)
                    {
                        if (currentElement.isMatched)
                        {
                            if (!currentElement.isAdjacentBomb)
                            {
                                currentElement.isMatched = false;
                                currentElement.MakeAdjacentBomb();
                            }
                        }
                        else
                        {
                            if (currentElement.nextDot != null)
                            {
                                var nextDot = currentElement.nextDot.GetComponent <Element>();
                                if (nextDot.isMatched)
                                {
                                    if (!nextDot.isAdjacentBomb)
                                    {
                                        nextDot.isMatched = false;
                                        nextDot.MakeAdjacentBomb();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #16
0
    private void CheckToMakeBomb()
    {
        //How many objects are in findMatches currentMatches?
        if (findMatches.currentMatches.Count > 3)
        {
            //What type of match?
            MatchType typeOfMatch = ColumnOrRow();
            if (typeOfMatch.type == 1)
            {
                //make a color bomb
                //is the current dot match?
                if (currentDot != null && currentDot.isMatched && currentDot.tag == typeOfMatch.color)
                {
                    currentDot.isMatched = false;
                    currentDot.MakeColorBomb();
                }

                else
                {
                    if (currentDot.otherDot != null)
                    {
                        Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                        if (otherDot.isMatched && otherDot.tag == typeOfMatch.color)
                        {
                            otherDot.isMatched = false;
                            otherDot.MakeColorBomb();
                        }
                    }
                }
            }
            else if (typeOfMatch.type == 2)
            {
                //make a adjacent bomb

                if (currentDot != null && currentDot.isMatched && currentDot.tag == typeOfMatch.color)
                {
                    currentDot.isMatched = false;
                    currentDot.MakeAdjacentBomb();
                }
                else
                {
                    if (currentDot.otherDot != null)
                    {
                        Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                        if (otherDot.isMatched && otherDot.tag == typeOfMatch.color)
                        {
                            otherDot.isMatched = false;
                            otherDot.MakeAdjacentBomb();
                        }
                    }
                }
            }
            else if (typeOfMatch.type == 3)
            {
                findMatches.CheckBombs(typeOfMatch);
            }
        }

        /*
         * if (findMatches.currentMatches.Count ==4)
         * {
         *  findMatches.CheckBombs();
         * }
         * if (findMatches.currentMatches.Count >= 5)
         * //if (findMatches.currentMatches.Count == 5 || findMatches.currentMatches.Count == 8)
         * {
         *  if (ColumnOrRow())
         *  {
         *      //make a color bomb
         *      //is the current dot match?
         *      if (currentDot != null)
         *      {
         *          if (currentDot.isMatched)
         *          {
         *              if (!currentDot.isColorBomb)
         *              {
         *                  currentDot.isMatched = false;
         *                  currentDot.MakeColorBomb();
         *              }
         *          }
         *          else
         *          {
         *              if (currentDot.otherDot != null)
         *              {
         *                  Dot otherDot = currentDot.otherDot.GetComponent<Dot>();
         *                  if (otherDot.isMatched)
         *                  {
         *                      if (!otherDot.isColorBomb)
         *                      {
         *                          otherDot.isMatched = false;
         *                          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)
         *              {
         *                  Dot otherDot = currentDot.otherDot.GetComponent<Dot>();
         *                  if (otherDot.isMatched)
         *                  {
         *                      if (!otherDot.isAdjacentBomb)
         *                      {
         *                          otherDot.isMatched = false;
         *                          otherDot.MakeAdjacentBomb();
         *                      }
         *                  }
         *              }
         *          }
         *      }
         *  }
         *
         * }
         */
    }
Beispiel #17
0
 private void CheckToMakeBombs()
 {
     if (findMatches.currentMatches.Count == 4 || findMatches.currentMatches.Count == 7)
     {
         findMatches.CheckBombs();
     }
     if (findMatches.currentMatches.Count == 5 || findMatches.currentMatches.Count == 8)
     {
         if (ColumnOrRow())
         {
             //s'il s'agit d'une collone ou d'une ligne, on crée une colorBomb
             if (currentDot != null)
             {
                 //vérifier si la pièce courante crée un match
                 if (currentDot.isMatched)
                 {
                     if (!currentDot.isColorBomb)
                     {
                         currentDot.isMatched = false;
                         currentDot.MakeColorBomb();
                     }
                 }
                 else
                 {
                     if (currentDot.otherDot != null)
                     {
                         Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                         if (otherDot.isMatched)
                         {
                             if (!otherDot.isColorBomb)
                             {
                                 otherDot.isMatched = false;
                                 otherDot.MakeColorBomb();
                             }
                         }
                     }
                 }
             }
         }
         else
         {
             //sinon on crée une adjacentBomb
             if (currentDot != null)
             {
                 //vérifier si la pièce courante crée un match
                 if (currentDot.isMatched)
                 {
                     if (!currentDot.isAdjacentBomb)
                     {
                         currentDot.isMatched = false;
                         currentDot.MakeAdjacentBomb();
                     }
                 }
                 else
                 {
                     if (currentDot.otherDot != null)
                     {
                         Dot otherDot = currentDot.otherDot.GetComponent <Dot>();
                         if (otherDot.isMatched)
                         {
                             if (!otherDot.isAdjacentBomb)
                             {
                                 otherDot.isMatched = false;
                                 otherDot.MakeAdjacentBomb();
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #18
0
    private void CheckToMakeBombs()
    {
        // how many objects are in findMatches/ currenmatcher
        if (findMatches.currentMatches.Count > 3)
        {
            // what type of match has been made
            MatchType typeOfMatch = ColumnOrRow();
            if (typeOfMatch.type == 1)
            {
                // Make a colour bomb
                // Is the current tile matched?
                // Unmatch it and turn it into a colour bomb
                if (currentTile != null && currentTile.isMatched && currentTile.tag == typeOfMatch.colour)
                {
                    currentTile.isMatched = false;
                    currentTile.MakeColourBomb();
                }
                else
                {
                    if (currentTile.otherShapeTile != null)
                    {
                        ShapeTile otherTile = currentTile.otherShapeTile.GetComponent <ShapeTile>();
                        if (otherTile.isMatched && otherTile.tag == typeOfMatch.colour)
                        {
                            otherTile.isMatched = false;
                            otherTile.MakeColourBomb();
                        }
                    }
                }
            }

            else if (typeOfMatch.type == 2)
            {
                // Make an adjacent bomb
                // Is the current tile matched?
                // Unmatch it and turn it into a colour bomb
                if (currentTile != null && currentTile.isMatched && currentTile.tag == typeOfMatch.colour)
                {
                    currentTile.isMatched = false;
                    currentTile.MakeAdjacentBomb();
                }
                else
                {
                    if (currentTile.otherShapeTile != null)
                    {
                        ShapeTile otherTile = currentTile.otherShapeTile.GetComponent <ShapeTile>();
                        if (otherTile.isMatched && otherTile.tag == typeOfMatch.colour)
                        {
                            otherTile.isMatched = false;
                            otherTile.MakeAdjacentBomb();
                        }
                    }
                }
            }
            else if (typeOfMatch.type == 3)
            {
                findMatches.CheckBombs(matchType);
            }

            #region OLD CODE

            /*
             * if (findMatches.currentMatches.Count == 4 || findMatches.currentMatches.Count == 7)
             * {
             *  findMatches.CheckBombs();
             * }
             * if (findMatches.currentMatches.Count == 5 || findMatches.currentMatches.Count == 8)
             * {
             *  if (ColumnOrRow())
             *  {
             *      // Make a colour bomb
             *      // Is the current tile matched?
             *      // Unmatch it and turn it into a colour bomb
             *      if (currentTile != null)
             *      {
             *          if (currentTile.isMatched)
             *          {
             *              if (!currentTile.isColourBomb)
             *              {
             *                  currentTile.isMatched = false;
             *                  currentTile.MakeColourBomb();
             *              }
             *          }
             *          else {
             *              if (currentTile.otherShapeTile != null)
             *              {
             *                  ShapeTile otherTile = currentTile.otherShapeTile.GetComponent<ShapeTile>();
             *                  if (otherTile.isMatched)
             *                  {
             *                      if (!otherTile.isColourBomb)
             *                      {
             *                          otherTile.isMatched = false;
             *                          otherTile.MakeColourBomb();
             *                      }
             *                  }
             *              }
             *          }
             *      }
             *  } else {
             *      // Make an adjacent bomb
             *      // Is the current tile matched?
             *      // Unmatch it and turn it into a colour bomb
             *      if (currentTile != null)
             *      {
             *          if (currentTile.isMatched)
             *          {
             *              if (!currentTile.isAdjacentBomb)
             *              {
             *                  currentTile.isMatched = false;
             *                  currentTile.MakeAdjacentBomb();
             *              }
             *          }
             *          else
             *          {
             *              if (currentTile.otherShapeTile != null)
             *              {
             *                  ShapeTile otherTile = currentTile.otherShapeTile.GetComponent<ShapeTile>();
             *                  if (otherTile.isMatched)
             *                  {
             *                      if (!otherTile.isAdjacentBomb)
             *                      {
             *                          otherTile.isMatched = false;
             *                          otherTile.MakeAdjacentBomb();
             *                      }
             *                  }
             *              }
             *          }
             *      }
             *
             *  }
             * }
             */
            #endregion
        }
    }