using DG.Tweening;
using UnityEngine;

public class PassLevelChecker : MonoBehaviour
{
    bool isPassLevel = false;
    [SerializeField]
    private Transform carTrans;
    [SerializeField]
    private Transform yellowBody;

    void Start()
    {
        isPassLevel = false;
    }

    private void OnTriggerEnter(Collider other)
    {
        if(other.tag == "Final" && !isPassLevel)
        {
            isPassLevel = true;
            Debug.Log("Pass Level");
            //GameObject.Find("EventSystem").SetActive(false);
            yellowBody.gameObject.SetActive(false);
            Invoke("PassLevelAnimation",3);
        }
    }

    void PassLevelAnimation()
    {
        carTrans.DOLocalMoveZ(9, 2).SetEase(Ease.Linear).OnComplete(() => {
            //结算
            //GameObject.Find("EventSystem").SetActive(true);
        });
    }
}
