IEnumerator Die() { gameObject.GetComponent <Renderer>().enabled = false; gameObject.GetComponent <DeathTouchHazard>().hazardous = false; particle.DeathParticleRelease(this.gameObject, true); yield return(new WaitForSeconds(particle.deathParticle.GetComponent <ParticleSystem>().main.duration)); DestroyObject(gameObject); }
public IEnumerator RespawnPlayer() { particle.DeathParticleRelease(player.gameObject); player.enabled = false; player.GetComponent <Renderer>().enabled = false; player.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); player.ResetShootingCooldown(); yield return(new WaitForSeconds(delayBeforeRespawn)); player.enabled = true; player.GetComponent <Renderer>().enabled = true; player.transform.position = currentCheckpoint.transform.position; particle.RespawnParticleRelease(player); yield break; }