using UnityEngine.UI;
|
using UnityEngine;
|
|
public class DropCoinImage : MonoBehaviour
|
{
|
Button tmpBtn;
|
FlyImage flyImage;
|
/// <summary>
|
/// Awake is called when the script instance is being loaded.
|
/// </summary>
|
void Awake()
|
{
|
tmpBtn = transform.GetComponent<Button>();
|
//flyImage = transform.GetComponent<FlyImage>();
|
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;
|
Transform end = GameObject.Find("UICamera/MainUI/FlyEndPos").transform;
|
//金币飞动 增加多少个金币,制造多少个
|
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);
|
}
|
}
|