private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("地板及水管")) { GM.GameOver(); } }
void CalculateScore() { for (int i = 0; i < width; i++) { for (int z = 0; z < lenght; z++) { if (buildGoalArry [z, i] != "") { if (buildDoneArry [z, i] == buildGoalArry [z, i]) { buildChunksArry [z, i].GetComponent <MeshRenderer>().material = greenMat; right++; } else { buildChunksArry [z, i].GetComponent <MeshRenderer>().material = redMat; wrong++; } } } } gm.GameOver(right * 100 / (wrong + right)); }
private void OnCollisionEnter2D(Collision2D collision) { // If the bird collides with anything, the game is over gameManger.GameOver(); }
// tells game to call GameOver function on collision public void OnCollisionEnter2D(Collision2D collision) { gameManger.GameOver(); }