//-----------------------------------------------------------// // PUBLIC HELPER FUNCTIONS (for calling from other scripts) // //-----------------------------------------------------------// ///Kills the player and turns them into an uncontrollable corpse. REMEMBER TO CALL THIS LAST public void Die() { if (!dead) { dead = true; myRagdoll.CreateRagdoll(); if (!SceneManager.GetActiveScene().name.Equals("LevelSelect")) { if (playerInt == 1) { LevelManager.lm.corpseCount1++; LevelManager.lm.NewDeath(true); } else if (playerInt == 2) { LevelManager.lm.corpseCount2++; LevelManager.lm.NewDeath(false); } } randomSound = Random.Range(1, 6); switch (randomSound) { case 1: audiosource.PlayOneShot(scream1); break; case 2: audiosource.PlayOneShot(scream2); break; case 3: audiosource.PlayOneShot(scream3); break; case 4: audiosource.PlayOneShot(scream4); break; case 5: audiosource.PlayOneShot(scream5); break; default: break; } } }