wangguan
2020-12-28 e439d913a7094082f9618731bed68fe6634dfed0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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);
    }
}