public void OnPlayerDeath(PlayerController caller) { // death effect Instantiate(playerDeathEffect, caller.transform.position, Quaternion.identity); // shake camera StartCoroutine(ShakeCamera(camDeathShakeDuration, camDeathShakeAmount)); // both died, reset if (p1.playerDead && p2.playerDead) { gameOver = true; StartCoroutine(ChangeScene()); return; } // update other player's velocity if (caller == p1) { p2PlatformsGen.DecrementVelocity(velocityDecrementDeathPercent); } else { p1PlatformsGen.DecrementVelocity(velocityDecrementDeathPercent); } // update overall score currentScore *= deathScoreKeepPercent; // respawn player StartCoroutine(RespawnPlayer(caller)); }