Beispiel #1
0
    void DestroyEnemy()
    {
        isEnemyDead = true;
        sm.PlaySound(0);
        if (isBoss)
        {
            GameObject p = Instantiate(fxExplo, transform.position, Quaternion.identity) as GameObject;
            p.GetComponent <ParticleSystem>().Play();
            Destroy(p, p.GetComponent <ParticleSystem>().main.duration);
            SpawnCoin(20);
            ship.AdSc(500);
            RootSpeedLevel.rootSpeedLevel.BossState = RootSpeedLevel.Boss.WaitBoss;
            RootSpeedLevel.rootSpeedLevel.TimerToInstatiateNewBoss *= 2f;
            sm.PlaySound(0);
            sm.PlaySound(0);
            countExBosses++;
            DefeatedBossesGeneration.defeatedBossesGeneration.countExBoss++;
            if (DefeatedBossesGeneration.defeatedBossesGeneration.countExBoss >= 5)
            {
                DefeatedBossesGeneration.defeatedBossesGeneration.generatorToActive.SetActive(true);
            }
        }
        else
        {
            SpawnCoin();
            ship.AdSc(25);
        }
        int countKilled = PlayerPrefs.GetInt("EnemyKilled", 0);

        countKilled++;
        PlayerPrefs.SetInt("EnemyKilled", countKilled);
        Destroy(gameObject);
    }
Beispiel #2
0
 void OnCollisionEnter2D(Collision2D coll)
 {
     if (coll.gameObject.CompareTag("enemyBull"))
     {
         Destroy(coll.gameObject);
         sm.PlaySound(1);
         ship.AdSc(5);
         Destroy(gameObject);
     }
 }
Beispiel #3
0
    void DestroyEnemy()
    {
        isEnemyDead = true;
        sm.PlaySound(0);
        SpawnCoin(5);
        ship.AdSc(50);

        int countKilled = PlayerPrefs.GetInt("EnemyKilled", 0);

        countKilled++;
        PlayerPrefs.SetInt("EnemyKilled", countKilled);
        Destroy(gameObject);
    }