private void OnCollisionEnter(Collision collision)
    {
        gameManager.ShowWhichBall(collision.gameObject.tag);

        switch (collision.gameObject.tag)
        {
        case "Solid":
            scoringSystem.BallInPocket(0);
            Destroy(collision.gameObject);
            break;

        case "Striped":
            scoringSystem.BallInPocket(1);
            Destroy(collision.gameObject);
            break;

        case "Black":
            scoringSystem.BlackBallInPocket();
            Destroy(collision.gameObject);
            break;

        case "White":
            scoringSystem.WhiteBallInPocket();
            break;

        default:
            break;
        }
    }
Ejemplo n.º 2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "White")
     {
         scoringSystem.WhiteBallInPocket();
     }
     else if (other.gameObject.tag == "Solid" || other.gameObject.tag == "Striped" || other.gameObject.tag == "Black")
     {
         other.transform.position = resetPos.transform.position;
         other.GetComponent <Rigidbody>().velocity = Vector3.zero;
     }
 }