-期末作品進度#4(血條)-
血條公式:血條 -1到1
程式碼
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
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);
bar.transform.localScale = new Vector3(blood/100f, 1f, 1f);
}
}
沒有留言:
張貼留言