示例#1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "CueBall")
        {
            CueBall.transform.position = startPos;
            CueBall.GetComponent <Rigidbody>().velocity = Vector3.zero;
            CueBall.GetComponent <Rigidbody>().rotation = Quaternion.identity;
            gamemanager.AddScore(-15);
        }

        if (collision.gameObject.tag == "NormalBall")
        {
            Destroy(collision.gameObject);
            gamemanager.AddScore(5);
        }
    }
示例#2
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "PlayerBullets")
     {
         gamemanager.AddScore(scoreValue);
         Destroy(gameObject);
         Destroy(collision.gameObject);
     }
 }
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "PlayerBullets")
     {
         currentHits++;
         if (currentHits == HitPoints)
         {
           Destroy(gameObject);
           gamemanager.AddScore(scoreValue);
            gameOver.enabled = true;
           Time.timeScale = 0;
         }
         Destroy(collision.gameObject);
     }
 }