using UnityEngine;
using UnityEngine.UI;
namespace TowerDefense.UI
{
///
/// UI object to display final score
///
public class ScorePanel : MonoBehaviour
{
///
/// Objects that represent the stars
///
public Image[] starImages;
public Sprite achievedStarSprite;
///
/// Show the correct number of stars for the score
///
/// The final score
public void SetStars(int score)
{
if (score <= 0)
{
return;
}
score = Mathf.Clamp(score, 0, starImages.Length);
for (int i = 0; i < score; i++)
{
starImages[i].sprite = achievedStarSprite;
}
}
}
}