public void killPlayer() { states.GetComponent <States>().characterState = CharacterState.Normal; if (lives != 0) { setVelocity(0f, 0f); setPosition(currentCheckpoint.GetComponent <Checkpoint>().position); UIController.GetComponent <UIFunctions>().setLives(lives - 1); UIController.GetComponent <UIFunctions>().setHealth(3); playerAudioController.GetComponent <AudioSource>().clip = dieSound; playerAudioController.GetComponent <AudioSource>().Play(); } else { playerAudioController.GetComponent <AudioSource>().clip = gameOverSound; playerAudioController.GetComponent <AudioSource>().Play(); pauseObject.GOPause(); GOCanvas.enabled = true; } }