private void Death(bool doDestroy) // no need to handle the non destructive death, since it never happens { OnDeath?.Invoke(); anim.SetBool("isDead", true); pc.StopControl(); Debug.Log("stopped control"); rb.velocity = Vector2.zero; //prevent sliding coroutines.WaitThenExecute(1f, () => { sf.FadeIn(); }); coroutines.WaitThenExecute(2f, () => { hs.FullHealth(); tr.position = respawnPoint; }); coroutines.WaitThenExecute(3f, () => { sf.FadeOut(); }); coroutines.WaitThenExecute(3.5f, () => { anim.SetBool("isDead", false); }); coroutines.WaitThenExecute(3.8f, () => { pc.RegainControl(); Debug.Log("regained control"); }); //TODO finesse this }
public void interact() { if (!hasBeenTouched) { sfx.TryPlayOnce("Ding"); SetHasBeenTouched(true); playerHealth.FullHealth(); } if (priority > stCurrentPriority) { plM.SetRespawnPoint(respawnPoint); stCurrentPriority = priority; } }
public override void OnEnterPlayMode() { foreach (var c in enabledOnlyInPlayModeAlive) { c.enabled = true; } foreach (var c in enabledOnlyInEditMode) { c.enabled = false; } rb.simulated = true; playerManager.SetRespawnPoint(new Vector2(transform.position.x, transform.position.y)); healthSystem.FullHealth(); }
public IEnumerator RespawnPlayerCo() { Instantiate(deathParticle, player.transform.position, player.transform.rotation); player.enabled = false; //stops the player actions player.GetComponent <Renderer>().enabled = false; //disappears the player camera.isFollowing = false; //player.GetComponent<Rigidbody2D>().velocity= Vector2.zero; defaultGravity = player.GetComponent <Rigidbody2D>().gravityScale; player.GetComponent <Rigidbody2D>().gravityScale = 0f; ScoreManager.AddPoints(-pointPenaltyOnDeath); Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); player.GetComponent <Rigidbody2D>().gravityScale = defaultGravity; player.transform.position = currentCheckpoint.transform.position; player.enabled = true; player.GetComponent <Renderer>().enabled = true; camera.isFollowing = true; healthSystem.FullHealth(); healthSystem.isDead = false; Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }
public void Resurrect() // called when play mode starts { hs.FullHealth(); m_damage = ogDamage; anim.SetBool("isDead", false); }