Exemplo n.º 1
0
    private void OnCollisionStay(Collision other)
    {
        Gumball ball = other.gameObject.GetComponent <Gumball>();

        if (ball != null)
        {
            Rigidbody rb = other.gameObject.GetComponent <Rigidbody>();
            rb.AddForce(transform.up * force, ForceMode.Impulse);
        }
    }
Exemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") && top == 0)
     {
         Gumball gumBall = collision.gameObject.GetComponent <Gumball>();
         gumBall.score++;
         top++;
         print("wearedoingitman");
     }
 }