Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D obj)
    {
        if (obj.tag == "Ball")
        {
            sr.sprite = S2;
            screenShake.Bump(0.25f);

            audioSource.clip = clips[Random.Range(0, clips.Length)];
            audioSource.Play();
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D obj)
    {
        if (obj.tag == "Ball")
        {
            OnHit?.Invoke();

            if (screenShake != null)
            {
                screenShake.Bump(0.5f);
            }

            foreach (var particle in ps)
            {
                particle.Play();
            }

            audioSource.clip = clips[UnityEngine.Random.Range(0, clips.Length)];
            audioSource.Play();
        }
    }