34 lines
739 B
C#
34 lines
739 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class loadingbar : MonoBehaviour {
|
|
|
|
private RectTransform rectComponent;
|
|
private Image imageComp;
|
|
public float speed = 0.0f;
|
|
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
rectComponent = GetComponent<RectTransform>();
|
|
imageComp = rectComponent.GetComponent<Image>();
|
|
imageComp.fillAmount = 0.0f;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (imageComp.fillAmount != 1f)
|
|
{
|
|
imageComp.fillAmount = imageComp.fillAmount + Time.deltaTime * speed;
|
|
|
|
}
|
|
else
|
|
{
|
|
imageComp.fillAmount = 0.0f;
|
|
|
|
}
|
|
}
|
|
}
|