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; // Ŀ<><C4BF>λ<EFBFBD><CEBB>
|
|||
|
public float flyDuration = 1f; // <20><><EFBFBD>г<EFBFBD><D0B3><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
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()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|