using UnityEngine.UI;
using UnityEngine;
public class DropCoinImage : MonoBehaviour
{
Button tmpBtn;
FlyImage flyImage;
///
/// Awake is called when the script instance is being loaded.
///
void Awake()
{
tmpBtn = transform.GetComponent();
//flyImage = transform.GetComponent();
tmpBtn.onClick.AddListener(OnClick);
}
private void OnClick()
{
StartFly();
}
bool countdown;
float timer;
public void Init()
{
timer = 0;
countdown = true;
tmpBtn.interactable = true;
}
// Update is called once per frame
void Update()
{
if (countdown)
{
timer += Time.deltaTime;
if (timer >= 3)
{
countdown = false;
StartFly();
}
}
}
private void StartFly()
{
tmpBtn.interactable = false;
RectTransform end = GameObject.Find("UICamera/MainUI/FlyEndPos").GetComponent();
//金币飞动 增加多少个金币,制造多少个
TowerDefense.Level.EndlessDropManager.instance.FlyIcon(
transform.parent,
null,
transform.position,
end.position,
true,
TowerDefense.Level.EndlessLevelManager.instance.DropCoin);
Core.Utilities.Poolable.TryPool(gameObject);
//flyImage.SetDestination(null, transform.position, end.position, true);
}
}