void OnTriggerEnter2D(Collider2D other) { // if collision to rain drop, then play sound, decrease health, and call to instantiate small water drop particles if (gameStatus != "gameOver") { if (other.tag == "raindrop") { bool gameContinue = healthBar.DecreaseHealth(); particleBrustManager.showRainParticles(); if (!gameContinue) { gameStatus = "gameOver"; SoundManagerScript.PlayDeadSound(); UIManager.ShowGameOverUI(); } else { SoundManagerScript.PlayWaterDropSound(); Destroy(other.gameObject); } } // if collision to flower, then play sound, score plus, and call to instantiate small petal particles else if (other.tag == "flower") { UIManager.AddScore(); SoundManagerScript.PlayScoreSound(); particleBrustManager.showFlowerParticles(); Destroy(other.gameObject); } // if collision to flower, then play sound, score plus, and call to instantiate small petal particles else if (other.tag == "lifeUp") { healthBar.IncreaseHealth(); SoundManagerScript.PlayLifeUpSound(); particleBrustManager.showLifeUpParticles(); Destroy(other.gameObject); } else if (other.tag == "magnet") { Destroy(other.gameObject); magnetArea.SetActive(true); magnetActivated = true; Timer = 5; UIManager.ShowTimerUI(true); } else if (other.tag == "bomb") { gameStatus = "gameOver"; UIManager.ShowGameOverUI(); SoundManagerScript.PlayExplodeSound(); particleBrustManager.showBombParticles(); healthBar.Dead(); SoundManagerScript.PlayDeadSound(); Destroy(other.gameObject); } else if (other.tag == "spidernet") { gameStatus = "gameOver"; UIManager.ShowGameOverUI(); Vector3 newPosition = new Vector3(other.gameObject.transform.position.x, other.gameObject.transform.position.y, 10.0f); player.gameObject.transform.parent = other.gameObject.transform; player.gameObject.transform.position = newPosition; other.gameObject.GetComponent <Rigidbody2D>().gravityScale = 0.0f; other.gameObject.GetComponent <Rigidbody2D>().velocity = Vector2.zero; healthBar.Dead(); SoundManagerScript.PlayDeadSound(); } } }