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

[RequireComponent(typeof(BoxCollider2D), typeof(Rigidbody2D))]
public class TeleportObject : MonoBehaviour
{
    private TeleportGate teleportGate;
    // Start is called before the first frame update
    void Start()
    {
        teleportGate = FindObjectOfType<TeleportGate>();
    }

    private void OnTriggerStay2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            if (Input.GetKeyUp(teleportGate.interactButton))
            {
                teleportGate.mapAnimator.SetTrigger(teleportGate.openMap);
            }
        }
    }
}
