using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Imagescript : MonoBehaviour {
Image image;
float hp=10;
// Use this for initialization
void Start () {
image = GetComponent<Image> ();
}
// 鼠标点击控制填充进度
void Update () {
if (Input.GetMouseButtonDown (0)) {
hp--;
if (hp <0)
hp = 0;
}
image.fillAmount = hp / 10;
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Imagescript : MonoBehaviour {
Image image;
float hp=10;
// Use this for initialization
void Start () {
image = GetComponent<Image> ();
}
// 鼠标点击控制填充进度
void Update () {
if (Input.GetMouseButtonDown (0)) {
hp--;
if (hp <0)
hp = 0;
}
image.fillAmount = hp / 10;
}
}