void OnCollisionEnter(Collision collision) { if (collision.collider.gameObject.CompareTag("Player")) { if (score > player2.getScore()) { player2.setScore(player2.getScore() - 1); colliderText.text = "Last Collision: Player 1 Won"; } if (score < player2.getScore()) { score--; SetScoreText(); colliderText.text = "Last Collision: Player 2 Won"; } } }
public void OnButtonClick() { time.timer = 120; player1.stop = false; player2.stop = false; player1.rb.velocity = Vector3.zero; player1.setScore(0); player1.transform.position = new Vector3(20, 0.5f, 0); player2.rb.velocity = Vector3.zero; player2.setScore(0); player2.transform.position = new Vector3(-20, 0.5f, 0); startPressed = true; buttonText.text = "Reset"; time.timeRemaining.text = ""; player1.colliderText.text = ""; pickUps1.SetActive(true); pickUps2.SetActive(true); pickUps3.SetActive(true); pickUps4.SetActive(true); pickUps5.SetActive(true); pickUps6.SetActive(true); pickUps7.SetActive(true); pickUps8.SetActive(true); pickUps9.SetActive(true); pickUps10.SetActive(true); pickUps11.SetActive(true); pickUps12.SetActive(true); pickUps13.SetActive(true); pickUps14.SetActive(true); pickUps15.SetActive(true); pickUps16.SetActive(true); pickUps17.SetActive(true); pickUps18.SetActive(true); pickUps19.SetActive(true); pickUps20.SetActive(true); pickUps21.SetActive(true); pickUps22.SetActive(true); pickUps23.SetActive(true); pickUps24.SetActive(true); pickUps25.SetActive(true); pickUps26.SetActive(true); }