Ejemplo n.º 1
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allTools[column, row].GetComponent <Tile>().isMatch)
        {
            if (findMatches.currentMatches.Count >= 4)
            {
                CheckMakeBombs();
            }

            if (goalManager != null)
            {
                goalManager.CompareGoal(allTools[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }
            findMatches.currentMatches.Remove(allTools[column, row]);

            if (soundManager != null)
            {
                soundManager.PlayNoise();
            }

            Destroy(allTools[column, row]);
            scoreManager.IncreaseScore(baseValue * streakValue);

            if (dog != null)
            {
                dog.UpdateHygiene(streakValue);
            }

            allTools[column, row] = null;
        }
    }
Ejemplo n.º 2
0
    //public void BombColumn(int column)
    //{
    //    for (int i = 0; i < width; i++)
    //    {
    //        for (int j = 0; j < height; j++)
    //        {
    //            if (concreteTiles[i, j])
    //            {
    //                concreteTiles[column, i].TakeDamage(1);
    //                if (concreteTiles[column, i].hitPoints <= 0)
    //                {
    //                    concreteTiles[column, i] = null;
    //                }
    //            }
    //        }
    //    }
    //}

    private void DestroyMatchesAt(int column, int row) // нанесение урона+анимация
    {
        if (allCircle[column, row].GetComponent <Circle>().isMatched)
        {
            // нужно ли ломать плитку?
            if (breakableTiles[column, row] != null)
            {
                //если да, нанесите один урон
                breakableTiles[column, row].TakeDamage(1);

                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                    Music.PlaySound("Breakable");
                }
            }

            if (lockTiles[column, row] != null)
            {
                //если да, нанесите один урон
                lockTiles[column, row].TakeDamage(1);

                if (lockTiles[column, row].hitPoints <= 0)
                {
                    Instantiate(lockDestroy, lockTiles[column, row].transform.position, Quaternion.identity);
                    lockTiles[column, row] = null;
                    Music.PlaySound("Lock");
                }
            }

            DamageConcrete(column, row);
            DamageSlime(column, row);

            // GoalManager
            if (goalManager != null)
            {
                goalManager.CompareGoal(allCircle[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

            // Менеджер звука существует?
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }

            GameObject particle = Instantiate(destroyEffect, allCircle[column, row].transform.position,
                                              Quaternion.identity);

            Destroy(particle, 1f);
            allCircle[column, row].GetComponent <Circle>().PopAnimation();
            ///////
            findMatches.currentMatches.Remove(allCircle[column, row]);
            ///////
            Destroy(allCircle[column, row], .3f);
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allCircle[column, row] = null;
            Music.PlaySound("DestroyCircle");
        }
    }
Ejemplo n.º 3
0
        private void DestroyMatchesAt(int column, int row)
        {
            if (allDots[column, row].GetComponent <Element>().isMatched)
            {
                //check count of matching pieces
                if (findMatches.currentMatches.Count > 3)
                {
                    CheckToMakeBombs();
                }

                //tile is need to break
                if (breakableTiles[column, row] != null)
                {
                    breakableTiles[column, row].TakeDamage();
                    if (breakableTiles[column, row].hitPoint <= 0)
                    {
                        breakableTiles[column, row] = null;
                    }
                }

                goalManager.CompareGoal(allDots[column, row].tag);
                goalManager.UpdateGoals();

                soundManager.PlayRandomDestroyNoise();

                var particle = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);
                Destroy(particle, .5f);
                Destroy(allDots[column, row]);
                scoreManager.IncreaseScore(basePieceValue * streakValue);
                allDots[column, row] = null;
            }
        }
Ejemplo n.º 4
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            if (breakableTiles[column, row] != null)
            {
                //if it does need to break take one hit
                breakableTiles[column, row].TakeHit(1);

                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }

            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

            if (AllJuice == true || someJuice == true)
            {
                GameObject particale = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);

                Destroy(particale, .5f);
            }

            if (AllJuice == true)
            {
                allDots[column, row].GetComponent <Dot>().explodable.generateFragments();
                ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();
                ef.doExplosion(transform.position);
            }

            //StartCoroutine(DestroysAfter(column, row, allDots[column, row]));

            if (AllJuice == true || someJuice == true)
            {
                audioSource.enabled = true;

                if (!audioSource.isPlaying)
                {
                    audioSource.clip = connectNormal;
                    audioSource.Play();
                }
            }

            Destroy(allDots[column, row]);
            //allDots[column, row].GetComponent<Renderer>().enabled = false;
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allDots[column, row] = null;
        }
    }
Ejemplo n.º 5
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dots>().isMatched)
        {
            //How many elements are in the matched pieces list from findmatches?


            //Does a tile needto Break
            if (breakableTiles[column, row] != null)
            {
                //if it does, give one damage.
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }
            if (lockTiles[column, row] != null)
            {
                //if it does, give one damage.
                lockTiles[column, row].TakeDamage(1);
                if (lockTiles[column, row].hitPoints <= 0)
                {
                    lockTiles[column, row] = null;
                }
            }
            DamageConcrete(column, row);
            DamageSlime(column, row);

            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoals();
                print("goaled");
            }
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }
            // matchFinder.currentDots.Remove(allDots[col, row]);//Note
            GameObject     destoryeffect = Instantiate(DestoryEffect, allDots[column, row].transform.position, Quaternion.identity);
            ParticleSystem pr0           =
                destoryeffect.transform.GetChild(0).gameObject.GetComponent <ParticleSystem>();
            pr0.startColor = allDots[column, row].GetComponent <SpriteRenderer>().color;
            ParticleSystem pr1 =
                destoryeffect.transform.GetChild(1).gameObject.GetComponent <ParticleSystem>();
            pr1.startColor = allDots[column, row].GetComponent <SpriteRenderer>().color;
            Destroy(destoryeffect, refillDelay);
            Destroy(allDots[column, row]);
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allDots[column, row] = null;
        }
    }
Ejemplo n.º 6
0
 void Update()
 {
     if (hitPoints <= 0)
     {
         if (goalManager != null)
         {
             goalManager.CompareGoal(this.gameObject.tag);
             goalManager.UpdateGoals();
         }
         Destroy(this.gameObject);
     }
 }
Ejemplo n.º 7
0
 public void Update()
 {
     if (hitPoints <= 0)
     {
         if (goalManager != null)
         {
             //faire en sorte que les pièces de glace soient aussi prise en compte dans le but du nineau
             goalManager.CompareGoal(this.gameObject.tag);
             goalManager.UpdateGoals();
         }
         Destroy(this.gameObject);
     }
 }
 public void TakeDamage(int damage)
 {
     hitPoints -= damage;
     MakeLighter();
     if (hitPoints <= 0)
     {
         if (goalManager != null)
         {
             goalManager.CompareGoal(this.gameObject.tag);
             goalManager.UpdateGoals();
         }
         Destroy(this.gameObject);
     }
 }
Ejemplo n.º 9
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            //Does a tile need to break
            if (breakableTiles[column, row] != null)
            {
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }

            //Does a tile need to break
            if (lockTiles[column, row] != null)
            {
                lockTiles[column, row].TakeDamage(1);
                if (lockTiles[column, row].hitPoints <= 0)
                {
                    lockTiles[column, row] = null;
                }
            }

            DamageIcing(column, row);
            DamageChocolate(column, row);

            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

            //Does the sound manager exist?
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }
            GameObject particle = Instantiate(destroyEffect,
                                              allDots[column, row].transform.position,
                                              Quaternion.identity);
            Destroy(particle, .5f);
            Destroy(allDots[column, row]);
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allDots[column, row] = null;
        }
    }
Ejemplo n.º 10
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            //Does a tile need to break?
            if (breakableTiles[column, row] != null)
            {
                //if it does, give one damage.
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }
            if (lockTiles[column, row] != null)
            {
                //if it does, give one damage.
                lockTiles[column, row].TakeDamage(1);
                if (lockTiles[column, row].hitPoints <= 0)
                {
                    lockTiles[column, row] = null;
                }
            }
            DamageConcrete(column, row);
            DamageSlime(column, row);
            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

            //Does the sound manager exist?
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }
            // Destroy edilen objenin parlaması için, destroyEffect prefab kodu.
            GameObject particle = Instantiate(destroyParticle,
                                              allDots[column, row].transform.position,
                                              Quaternion.identity);
            Destroy(particle, .5f);// Kalıntı bırakmaması hafızada yer işgal etmemesi için silindi.
            //allDots[column, row].GetComponent<Dot>().PopAnimation();
            Destroy(allDots[column, row]);
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allDots[column, row] = null;
        }
    }
Ejemplo n.º 11
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            //Does a tile need to break?
            if (breakableTiles[column, row] != null)
            {
                //if it does, give one damage
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoint <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }
            if (lockTiles[column, row] != null)
            {
                //if it does, give one damage
                lockTiles[column, row].TakeDamage(1);
                if (lockTiles[column, row].hitPoint <= 0)
                {
                    lockTiles[column, row] = null;
                }
            }
            DamageConcrete(column, row);
            DamageSlime(column, row);
            if (goalMAnager != null)
            {
                goalMAnager.CompareGoal(allDots[column, row].tag.ToString());
                goalMAnager.UpdateGoals();
            }
            //Does the sound manager exit?
            int panel = PlayerPrefs.GetInt("panel");
            if (panel != 1 && soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }

            GameObject particle = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);
            Destroy(particle, .5f);
            allDots[column, row].GetComponent <Dot>().PopAnim();
            Destroy(allDots[column, row], .5f);
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allDots[column, row] = null;
        }
    }
Ejemplo n.º 12
0
    //Eşleşmeleri belirli noktalarda yok edecek olan metot;
    private void DestroyMatchesAt(int column, int row)
    {
        if (allHexes[column, row].GetComponent <Hex>().isMatched)
        {
            if (goalManager != null)
            {
                goalManager.CompareGoal(allHexes[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

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

            Destroy(particle, .5f); //Prefab ayarında yarım saniye süresine ayarlı olduğu için buraya da aynı süreyi verdik.
            Destroy(allHexes[column, row]);
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allHexes[column, row] = null;
        }
    }
Ejemplo n.º 13
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            if (findMatches.currentMatches.Count >= 4)
            {
                CheckToMakeBombs();
            }

            // Does a tile need to break?
            if (breakableTiles[column, row] != null)
            {
                // give 1 damage to tile.
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }

            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

            if (hintManager != null)
            {
                hintManager.DestroyHint();
            }

            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }

            GameObject particle = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);
            Destroy(particle, destroyParticleAfterNSeconds);
            Destroy(allDots[column, row]);
            scoreManager.IncreaseScore(defaultScoreValue * streakValue);
            allDots[column, row] = null;
        }
    }
Ejemplo n.º 14
0
    private void DistroyMatchesAt(int column, int row) //detruire les matchs à une position donnée
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            //Vérifier combien de pièces construisant le match
            if (findMatches.currentMatches.Count >= 4)
            {
                CheckToMakeBombs();
            }
            //si c'est une pièce de glace, il faut essayer de la casser
            if (breakableTiles[column, row] != null)
            {
                //nombre d'essais pour casser la pièce ++
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }

            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

            //si le soundManager existe
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }

            //créer animation de destruction
            GameObject particle = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);

            //détruire l'objet après un certain temps pour ne pas occuper de la mémoire
            Destroy(particle, .5f);
            Destroy(allDots[column, row]);
            scoreManager.IncreaseScore(basePieceValue * streakValue);//quand on a un match, le joueur gagne en score
            allDots[column, row] = null;
        }
    }
Ejemplo n.º 15
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            //How many elements are in the match pieces list from find matches
            if (findMatches.currentMatches.Count >= 4)
            {
                CheckToMakeBombs();
            }

            //Does a tile need to break?
            if (breakableTiles[column, row] != null)
            {
                //If it does give one damage
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }


            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoal();
            }

            //Does the sound manager exist?
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }
            GameObject particle = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);
            Destroy(particle, .5f);
            Destroy(allDots[column, row]);
            scoreManager.IncreaseScore(basePieceValue * streakValue, scoreGoals);
            allDots[column, row] = null;
        }
    }
Ejemplo n.º 16
0
 //This will destroy matched dots
 private void DestroyMatchesAt(int column, int row)
 {
     if (allDots[column, row].GetComponent <Dot>().isMatched)
     {
         if (goalManager != null)
         {
             goalManager.CompareGoal(allDots[column, row].tag.ToString());
             goalManager.UpdateGoals();
         }
         //Check if sound manager exists
         if (soundManager != null)
         {
             soundManager.PlayRandomDestroyNoise();
         }
         GameObject particle = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);
         //Destroy the particle after .5f
         Destroy(particle, .5f);
         Destroy(allDots[column, row]);
         scoreManager.IncreaseScore(basePieceValue * streakValue);
         allDots[column, row] = null;
     }
 }
Ejemplo n.º 17
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.curMatches.Count >= 4)
            {
                CheckToMakeBombs();
            }

            //does a tile need to break?
            if (breakableTiles[column, row] != null)
            {
                //if it does - substrackt 1 hp
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }

            if (goalManager != null)
            {
                goalManager.CompareGoal(alldots[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }
            GameObject particle = Instantiate(destroyFX,
                                              alldots[column, row].transform.position,
                                              Quaternion.identity);

            Destroy(particle, 0.5f);
            Destroy(alldots[column, row]);
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            alldots[column, row] = null;
        }
    }
Ejemplo n.º 18
0
    // This function handles destroying matches at the correct column and row on the board
    private void DestroyMatchesAt(int column, int row)
    {
        // Destroy matches at position
        // Check if shape is matched, destroy
        if (allShapeTiles[column, row].GetComponent <ShapeTile>().isMatched)
        {
            // Does a tile need to break?
            if (breakableTiles[column, row] != null)
            {
                // if it does, give one damage
                breakableTiles[column, row].TakeDamage(1); // DONT HARD CODE THIS VALUE
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    // remove from array
                    breakableTiles[column, row] = null;
                }
            }

            if (lockedTiles[column, row] != null)
            {
                // if it does, give one damage
                lockedTiles[column, row].TakeDamage(1); // DONT HARD CODE THIS VALUE
                if (lockedTiles[column, row].hitPoints <= 0)
                {
                    // remove from array
                    lockedTiles[column, row] = null;
                }
            }

            DamageConcrete(column, row);
            DamageSlime(column, row);

            // Check for goals
            if (goalManager != null)
            {
                // Compare tag
                goalManager.CompareGoal(allShapeTiles[column, row].tag.ToString());
                // Update goal
                goalManager.UpdateGoals();
            }

            // Does the soundmanager exist
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoise();
            }
            else
            {
                return;
            }


            // Instantiate Particle effect
            GameObject particle = Instantiate(destroyEffect, allShapeTiles[column, row].transform.position, Quaternion.identity);
            Destroy(particle, 1f);

            // Destroy the correct tile at the column and row position
            Destroy(allShapeTiles[column, row]);
            //Increase score
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            // Set that coord to null (leaving it empty)
            allShapeTiles[column, row] = null;
        }
    }
Ejemplo n.º 19
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 findmatch?
            if (findMatches.currentMatches.Count >= 4)
            {
                CheckToMakeBombs();
            }

            //Does a tile need to break
            if (breakableTiles[column, row] != null)
            {
                //if it does, get one damage
                breakableTiles[column, row].TakeDamage(1);
                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }

            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

            //does the sound manager exist
            if (soundManager != null)
            {
                soundManager.PlayRandomDestroyNoice();
            }

            GameObject particle = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);
            Destroy(particle, .5f);
            Destroy(allDots[column, row]);
            GameObject obj1 = allDots[column, row];
            if (obj1.gameObject.CompareTag("Axe"))
            {
                scoreManager.IncreaseScore1(BaseValue * streakValue);
            }
            else if (obj1.gameObject.CompareTag("Cargills ice cream"))
            {
                scoreManager.IncreaseScore2(BaseValue * streakValue);
            }
            else if (obj1.gameObject.CompareTag("Cloguard"))
            {
                scoreManager.IncreaseScore3(BaseValue * streakValue);
            }
            else if (obj1.gameObject.CompareTag("Closeup"))
            {
                scoreManager.IncreaseScore4(BaseValue * streakValue);
            }
            else if (obj1.gameObject.CompareTag("EH ice cream"))
            {
                scoreManager.IncreaseScore5(BaseValue * streakValue);
            }
            else if (obj1.gameObject.CompareTag("Signal"))
            {
                scoreManager.IncreaseScore6(BaseValue * streakValue);
            }

            allDots[column, row] = null;
        }
    }