void OnCollisionEnter(Collision col) { if (col.gameObject.name == "Player1") { SpinOut.SpinPlayer1(); Destroy(gameObject); } if (col.gameObject.name == "Player2") { SpinOut.SpinPlayer2(); Destroy(gameObject); } }
void OnTriggerEnter(Collider col) { if (col.gameObject.name == "Motorcycle") { if (col.GetComponent <BikeNumber>().BikeNum == 1) { SpinOut.SpinPlayer1(); } else if (col.GetComponent <BikeNumber>().BikeNum == 2) { SpinOut.SpinPlayer2(); } } else if (col.gameObject.name == "Player1") { SpinOut.SpinPlayer1(); } else if (col.gameObject.name == "Player2") { SpinOut.SpinPlayer2(); } }