You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
799 B

1 year ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
namespace BuildSystem
{
public class BuildTip : MonoBehaviour
{
public GameObject tipPrfab;
public void ShowTip(string text="放置失败") {
StartCoroutine(Show(text));
}
IEnumerator Show(string text)
{
GameObject tip = Instantiate(tipPrfab, transform);
tip.SetActive(true);
tip.GetComponentInChildren<Text>().text = text;
tip.transform.position = new Vector3(Screen.width / 2, 0, 0);
tip.transform.DOMove(new Vector3(Screen.width / 2, Screen.height / 2, 0),2);
yield return new WaitForSeconds(3);
Destroy(tip);
}
}
}