备份CatanBuilding瘦身独立工程
This commit is contained in:
31
Assets/Scripts/FishingBox/FlyingFishingBox.cs
Normal file
31
Assets/Scripts/FishingBox/FlyingFishingBox.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user