void OnCollisionEnter2D(Collision2D col) { Destroy(col.gameObject); if (col.collider.tag == "Letter" && !GameController.instance.gameOver) { if (!(letterTray.AddLetter(col.collider.GetComponent <LetterMovement>().letter))) { //Only runs when no word can be made trayDisplay.Force(); trayDisplay.BlinkBad(); boatSound.PlayOneShot(failBeep); --GameController.instance.lives; if (letterTray.ClearWord()) { Debug.Log("Uh oh"); } } else { //Picked up a good letter pitched.pitch = (1.0f - 1.0f / (letterTray.currString.Length + 1)) * 2.0f + 0.1f; pitched.Play(); } } }
void OnCollisionEnter2D(Collision2D col) { Destroy(col.gameObject); if (col.collider.tag == "Letter") { if (!(letterTray.AddLetter(col.collider.GetComponent <LetterMovement>().letter))) { //Only runs when no word can be made --GameController.instance.lives; letterTray.ClearWord(); } } }