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

public class OnGroundChecker : MonoBehaviour 
{

    public LayerMask CollisionMask; 

    private Entity entity; 

    public void Start()
    {
        this.entity = this.GetComponentInParent<Entity>(); 
    }

    public void OnTriggerEnter2D(Collider2D collision)
    {
        if (Util.IsInLayerMask(collision.gameObject.layer, CollisionMask))
        {
            entity.SetIsOnGround(true); 
        }
    }

    public void OnTriggerExit2D(Collider2D collision)
    {
        if (Util.IsInLayerMask(collision.gameObject.layer, CollisionMask))
        {
            entity.SetIsOnGround(false);
        }
    }

}
