using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HeadBounce : Touching
{
    private void OnTriggerEnter2D(Collider2D _col)
    {
        if (_col.gameObject.layer == LayerMask.NameToLayer("Ground"))
        {
            touching = true;
            if (this.transform.parent.TryGetComponent(out Rigidbody2D rgParent))
            {
                rgParent.velocity = new Vector2(rgParent.velocity.x, 0);
            }
        }
    }
    private void OnTriggerExit2D(Collider2D _col)
    {
        if (_col.gameObject.layer == LayerMask.NameToLayer("Ground"))
        {
            touching = false;
        }
    }
}
