using DG.Tweening;
using UnityEngine;

public class hobocontroller : MonoBehaviour
{
    public GameObject pathParent;

    // Start is called before the first frame update
    void Start()
    {
        Vector3[] pathArray = new Vector3[pathParent.transform.childCount];
        for (int i = 0; i < pathArray.Length; i++)
        {
            pathArray[i] = pathParent.transform.GetChild(i).position;
        }

        transform.DOPath(pathArray, 17f).SetLookAt(0.01f).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.Linear);
    }

    public void StopPath()
    {
        transform.DOKill();
        gameObject.GetComponent<Animator>().SetBool("isEnd", true);

        Destroy(gameObject, 7f);
    }
}
