wangguan
2020-12-15 0d6a2e6d4b9de57a13c2bcb32148e1eb97ef1b1f
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
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
public class TowerBloodVis : MonoBehaviour
{
    /// <summary>
    /// 背景图片
    /// </summary>
    public Image bgImage;
 
    // Start is called before the first frame update
    void Start()
    {
    }
 
    /// <summary>
    /// 设置当前的Health Scale.
    /// </summary>
    /// <param name="scale"></param>
    public void SetHealthScale( float scale)
    {
        if( scale == 0.0f)
        {
            Destroy(this);
        }
        else if( scale < 0.34f)
        {
            bgImage.rectTransform.DOScaleX( 0.666666f,0.3f );
        }
        else if( scale < 0.67f)
        {
            bgImage.rectTransform.DOScaleX( 0.333333f, 0.3f);
        }
        else
        {
            bgImage.rectTransform.DOScaleX(0.0f, 0.3f);
        }
    }
 
    // Update is called once per frame
    void Update()
    {
 
    }
}