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

public class ButtonController : MonoBehaviour
{
    public Collider2D playerCollider;
    public Animator animator;

    private Collider2D buttonCollider;

    public float buttonPressedDuration = 1.0f;
    private float buttonPressedDurationCounter;

    private void Awake()
    {
        buttonCollider = GetComponent<BoxCollider2D>();
    }

    void Update()
    {
        if (buttonCollider.IsTouching(playerCollider)) 
        {
            animator.SetBool("ButtonPressed", true);
            buttonPressedDurationCounter = buttonPressedDuration;
        } else {
            animator.SetBool("ButtonPressed", false);
        }
    }
}
