mirror of
https://github.com/zoriya/Skillfight.git
synced 2026-05-13 19:34:58 +00:00
24 lines
577 B
C#
24 lines
577 B
C#
using UnityEngine.UI;
|
|
using UnityEngine;
|
|
|
|
public class HealthText : MonoBehaviour {
|
|
|
|
public Slider slider;
|
|
public Transform noHandle;
|
|
public Transform Handle;
|
|
|
|
public void ValueChange()
|
|
{
|
|
GetComponent<Text>().text = slider.value.ToString() + "/" + slider.maxValue.ToString() + " Hp";
|
|
if(slider.value/slider.maxValue <= 0.25)
|
|
{
|
|
transform.SetParent(noHandle);
|
|
}
|
|
else
|
|
{
|
|
transform.SetParent(Handle);
|
|
transform.localPosition = new Vector3(-56.1f, 5.7f, 0);
|
|
}
|
|
}
|
|
}
|