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

public class Unlock : MonoBehaviour
{
    private void OnTriggerEnter(Collider other)
    {
        string tag = gameObject.tag;
        Debug.Log(tag);
        //char num = name[name.Length - 1];
        if (PlayerState.inventory.Contains(tag))
        {
            StartCoroutine(fly());
        }
    }

    IEnumerator fly()
    {
        for(int i = 0; i < 100; i++)
        {
            transform.position += new Vector3(0, 2, 0);
            yield return new WaitForSeconds(0.05f);
        }
        Destroy(gameObject);
    }
}
