32 lines
785 B
C#
32 lines
785 B
C#
using asap.core;
|
|
using com.fpnn.livedata;
|
|
using DG.Tweening;
|
|
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class FlyingFishingBox:MonoBehaviour
|
|
{
|
|
private Image img;
|
|
public Action ArriveAction;
|
|
|
|
public void DoFly(Vector3 targetPos, string icon)
|
|
{
|
|
img = transform.Find("icon").GetComponent<Image>();
|
|
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(img, icon);
|
|
gameObject.SetActive(true);
|
|
transform.DOScale(Vector3.one * 0.92f,0.7f).SetEase(Ease.InOutBounce);
|
|
transform.DOMove(targetPos, 0.7f).OnComplete(OnArrive);
|
|
}
|
|
|
|
public void OnArrive()
|
|
{
|
|
ArriveAction?.Invoke();
|
|
ArriveAction = null;
|
|
gameObject.SetActive(false);
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
}
|