Files
unity-application/Assets/Accounts/Scripts/LearnableProgressCard.cs
2023-05-04 09:09:49 +00:00

41 lines
1.1 KiB
C#

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Class to handle learnable progress card display
/// </summary>
public class LearnableProgressCard : MonoBehaviour
{
/// <summary>
/// Reference to the progress so we can display a progress bar
/// </summary>
public PersistentDataController.SavedLearnableProgress progress;
/// <summary>
/// Reference to the list of minigameCards so we can query the correct course
/// </summary>
public Learnable learnable;
/// <summary>
/// UI reference to the thumbnail of the course
/// </summary>
public Image thumbnail;
/// <summary>
/// UI refeerence to the title of the course
/// </summary>
public List<Image> stars;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
thumbnail.sprite = learnable.image;
var starRewards = new float[] { 1.0f, 2.5f, 4.0f, };
for (int i = 0; i < 3; i++)
stars[i].color = starRewards[i] < progress.progress ? Color.white : Color.black;
}
}