Example #1
0
    void OnTriggerEnter2D(Collider2D other)
    {                     //  http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnTriggerEnter2D.html
        if (other.gameObject.tag == "Player")
        {
            AudioSource.PlayClipAtPoint(impact, transform.position);
            mylevelManager.AddBalls(ballValue);
            Destroy(gameObject); // this destroys the collider as well
        }



        if (Door1.instance != null)
        {
            Door1.instance.DecreaseCollectibles();
        }
    }