private void Update() { if (!WaveHandler.waveActive) { WaveEnd(); } if (isDying) { deathTimecurrent += Time.deltaTime; if (deathTimecurrent >= deathTimeMax) { deathTimecurrent = 0.0f; isDying = false; currentHealth = 0.0f; ec.firePos.healthSlider.value = currentHealth; sc.AddToScore(goldPayout); ec.firePos.inUse = false; ec.firePos.healthCanvas.SetActive(false); FirePosScoreIndicator fpsi = ec.firePos.gameObject.GetComponent <FirePosScoreIndicator>(); fpsi.TriggerScore(goldPayout); Destroy(gameObject); } } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.layer == 12) { gameObject.SetActive(false); } else if (other.gameObject.layer == 9) { particleManager.PlayRandomParticleAtPosition(other.ClosestPointOnBounds(transform.position)); other.gameObject.transform.parent.gameObject.SetActive(false); gameObject.SetActive(false); sfxManager.PlayImpactSound(); scoreSystem.AddToScore(10); } }