using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour {
public List<GameObject> list_color = new List<GameObject>();
private List<float> mmm=new List<float>();
// Use this for initialization
void Start () {
float tempall = 0;
mmm.Add(0.2f);
mmm.Add(0.2f);
mmm.Add(0.2f);
mmm.Add(0.2f);
mmm.Add(0.2f);
for (int i = 0; i < mmm.Count; i++)
{
tempall += mmm[i];
//list_color[i].GetComponent<Image>().fillAmount = tempall / all;
setFillAmount(list_color[i], tempall, 0.3f);
}
}
private void setFillAmount(GameObject obj, float fillAmount, float speed)
{
float fillTemp = obj.GetComponent<Image>().fillAmount;
//Debug.Log("fillTemp:"+fillTemp);
if (fillTemp + Time.deltaTime * speed < fillAmount)
obj.GetComponent<Image>().fillAmount = fillTemp + Time.deltaTime * speed;
else
obj.GetComponent<Image>().fillAmount = fillAmount;
}
// Update is called once per frame
void Update () {
}
}