Week 13
血量條設定方式
期末進度更新
公式運算(計從1-200)
code
public class calcBlood : MonoBehaviour
{
public float blood=100f;
public GameObject bar;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
bar.transform.localPosition = new Vector3(blood/100f-1f, 0, 0);
{
public float blood=100f;
public GameObject bar;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
bar.transform.localPosition = new Vector3(blood/100f-1f, 0, 0);
///讓血條回到初始位置
bar.transform.localScale = new Vector3(blood/100f, 1f, 1f);}
}
沒有留言:
張貼留言