1234567891011121314151617181920212223242526272829303132 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class ProgressLevelController : MonoBehaviour
- {
- public List<Image> ListImagesLevelProgress;
-
- public void UpdateListImages(int stage)
- {
-
- var value = stage / LevelManager.STAGE_LEVEL;
- int indexLevel = Mathf.CeilToInt(value);
- var v = value - indexLevel;
- for (var i = 0; i < ListImagesLevelProgress.Count; i++)
- {
- if(i <= indexLevel)
- {
- ListImagesLevelProgress[i].fillAmount = 1;
- }
- else if(i == indexLevel+1)
- {
- ListImagesLevelProgress[i].fillAmount = v / LevelManager.STAGE_LEVEL;
- }
- else
- {
- ListImagesLevelProgress[i].fillAmount = 0;
- }
- }
- }
- }
|