using UnityEngine;
using System.Collections;
using DG.Tweening;

public class LandPuzzleAnimation : MonoBehaviour
{

    public GameObject targetObj;
    public GameObject img;
    void Start()    
    {
       
    }
    private void OnEnable()
    {
        transform.DOScale(1.2f, 0.5f).OnComplete(dissmissAnimation).SetEase(Ease.Linear);
    }
    private void dissmissAnimation()
    {
        Debug.Log("碎片放大完成");
        img.transform.DOLocalRotate(new Vector3(0, 0, 360), 0.1f, RotateMode.FastBeyond360)
            .SetLoops(5).SetEase(Ease.Linear);
        transform.DOMove(targetObj.transform.position, 0.5f).SetEase(Ease.Linear);
        transform.DOScale(0.8f, 0.5f).OnComplete(dissmissAnimation2).SetEase(Ease.Linear);
    }
    private void dissmissAnimation2()
    {
        Debug.Log("碎片放大完成2");
        img.transform.DOKill(true);
        transform.localPosition = new Vector3(0, 0, 0);
        transform.gameObject.SetActive(false);
    }

}
