Пример #1
0
 private void CheckHealth()
 {
     if (Health <= 0)
     {
         GameObject explosionGO = Instantiate(explosion, transform.position, Quaternion.identity);
         explosionGO.transform.position = new Vector2(transform.position.x, transform.position.y + 0.5f);
         uiManager.AddScore(PersistentManager.getAsteroidScore(asteroidId));
         Destroy(explosionGO, 1.1f);
         Destroy(gameObject);
     }
 }
Пример #2
0
    private void CheckHealth()
    {
        if (Health <= 0)
        {
            GameObject explosionGO = Instantiate(explosion, transform.position, Quaternion.identity);
            explosionGO.transform.position = new Vector2(transform.position.x, transform.position.y + 0.5f);
            uiManager.AddScore(PersistentManager.getEnemyScore(enemyId));
            Destroy(explosionGO, 1.1f);
            if (enemyId == 4)
            {
                Instantiate(powerUp[Random.Range(0, 5)], transform.position, Quaternion.identity);
            }

            AudioManager.instance.StopAudio();
            Destroy(gameObject);
        }
    }