private void Die() { collectablesScript.SpawnRandomCollectable(transform); scoreManagerScript.AddScore(pointsOnDeath); AudioSource.PlayClipAtPoint(deathSound, transform.position); var explosionEffect = Instantiate(explosionEffectPrefab, transform.position, Quaternion.identity) as GameObject; Destroy(gameObject); Destroy(explosionEffect, 1f); }
public void DestroyByPlayer() { Debug.Log("Destroyed by the player"); score.RaiseScore(pointsOnPlayerDestruction); collectables.SpawnRandomCollectable(transform); enemiesScript.currentEnemiesAmount--; Destroy(this.gameObject); }