41 lines
860 B
C#
41 lines
860 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using DG.Tweening;
|
|
public class WaterDrop : MonoBehaviour
|
|
{
|
|
|
|
public Button DropBtn;
|
|
public Transform targetPosition; // Ä¿±êλÖÃ
|
|
public float flyDuration = 1f; // ·ÉÐгÖÐøʱ¼ä
|
|
public int id;
|
|
|
|
|
|
void Start()
|
|
{
|
|
DropBtn =GetComponent<Button>();
|
|
DropBtn.onClick.AddListener(DropClick);
|
|
}
|
|
|
|
async void DropClick()
|
|
{
|
|
bool succefful = await Scene_main_jiekou.instance.TreeGetWaters(id, "string");
|
|
|
|
if (succefful)
|
|
{
|
|
transform.DOMove(targetPosition.position, flyDuration)
|
|
.OnComplete(() =>
|
|
Destroy(this.gameObject)
|
|
);
|
|
}
|
|
|
|
|
|
}
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|