public void Death() { int randomSound = Random.Range(0, 3); switch (randomSound) { case 0: SoundPool.instance.PlaySound(SoundClips.instance.EnemyExplosion, transform.position, false, false, 0.5f); break; case 1: SoundPool.instance.PlaySound(SoundClips.instance.EnemyExplosion2, transform.position, false, false, 0.5f); break; case 2: SoundPool.instance.PlaySound(SoundClips.instance.EnemyExplosion3, transform.position, false, false, 0.5f); break; } GameObject temp = Instantiate(explosionPrefab, transform.position, transform.rotation); Destroy(temp, 2f); // Destroy(this.transform.root.gameObject); GameManager.instance.procObjectManager.Deallocate(transform.root.gameObject); CombatBalancing.IncrementEnemiesKilled(); GameObject tempEnergy = Instantiate(energyPickupTiers[Mathf.Min(enemyTier, 2)], transform.position - transform.forward * 2f, Quaternion.identity); }
private void Start() { enemyTier = CombatBalancing.curEnemyTier; health = CombatBalancing.GetMaxHealthAtTier(enemyTier + 1) + bonusHealth * (enemyTier + 1); maxHealth = health; Debug.Log("Registered new enemy with " + maxHealth); EnemyHealthBarSystem.instance.RegisterNewHealthBar(this); }