血條
電流急急棒 如果手把碰到障礙物就會扣血公式運算
血條 -1到1
是200
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); //-1 新血條才會回到原位
bar.transform.localScale = new Vector3(blood/100f, 1f, 1f);
}
}
沒有留言:
張貼留言