You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
640 B
30 lines
640 B
3 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class MyDataBar : MonoBehaviour {
|
||
|
public Image BarImgPostive;
|
||
|
public Image BarImgNagetive;
|
||
|
[Range(-100f,100f)]
|
||
|
public float values;
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start () {
|
||
|
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
if (values >= 0)
|
||
|
{
|
||
|
BarImgPostive.fillAmount = values / 100;
|
||
|
BarImgNagetive.fillAmount = 0;
|
||
|
}
|
||
|
else {
|
||
|
BarImgPostive.fillAmount = 0;
|
||
|
BarImgNagetive.fillAmount = -values / 100;
|
||
|
}
|
||
|
}
|
||
|
}
|