Pig.OnTriggerEnter2D C# (CSharp) Method

OnTriggerEnter2D() public method

public OnTriggerEnter2D ( Collider2D col ) : void
col UnityEngine.Collider2D
return void
    void OnTriggerEnter2D(Collider2D col)
    {
        if(col.gameObject.tag == "Player")
        {
            isSinking = true;
            sunk = true;
            if (!gameObject.GetComponent<AudioSource>().isPlaying)
            {
                gameObject.GetComponent<AudioSource>().PlayOneShot(jumpSounds[Random.Range(0, jumpSounds.Length)]);
            }
        }
    }