chenxin
2020-12-25 adb0dae8a82a7eabb4e686bc0e83c8859bf6445f
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
using UnityEngine.UI;
using UnityEngine;
using DG.Tweening;
public class DoubleHitImg : MonoBehaviour
{
    //[SerializeField]
    //private Sprite hit_10;
    private Image _image;
    private Color normal, dark;
    // Start is called before the first frame update
    void Start()
    {
        _image = GetComponent<Image>();
        normal = new Color(1.0f, 1.0f, 1.0f, 1.0f);
        dark = new Color(1.0f, 1.0f, 1.0f, 0.0f);
        isShowing = false;
    }
 
    bool isShowing;
    private float showTime = 3.0f;
    private Vector3 showV3 = new Vector3(0.7f, 0.7f, 0.7f);
    public void SetkillCount()
    {
        _image.DOKill();
        _image.color = dark;
        transform.localScale = showV3;
 
        _image.DOColor(normal, showTime * 0.5f).OnComplete(() =>
        {
            _image.DOColor(dark, showTime * 0.5f);
        });
        transform.DOScale(Vector3.one, showTime * 0.5f).SetEase(Ease.OutElastic);
    }
 
 
}