Question by
CLCEntertainment · Oct 30, 2015 at 09:49 PM ·
c#unity 5
Progress Bar w/ sprite placement help
I currently have a straight rectangle progress bar with stars that indicate where you earn that star while your progress bar fills im trying to create a curved one like seen in my upload image and i figured out how to fill the bar but the code im using to place the images wont work cause its not a rectangle shape and it used the rect trans to get the width of the bar and then place the first second and third star along that, can anyone help or have an suggestion on how i could go about placing my stars on a curve that matches the progress bar?
this is my current code for my rectangle star bar
void PrepareStars()
{
float width = GetComponent<RectTransform>().rect.width;
stars[0].transform.localPosition = new Vector3(LevelManager.Instance.star1 * 100 / LevelManager.Instance.star3 * width / 100 - (width / 2f), stars[0].transform.localPosition.y, 0);
stars[1].transform.localPosition = new Vector3(LevelManager.Instance.star2 * 100 / LevelManager.Instance.star3 * width / 100 - (width / 2f), stars[1].transform.localPosition.y, 0);
stars[0].transform.GetChild(0).gameObject.SetActive(false);
stars[1].transform.GetChild(0).gameObject.SetActive(false);
stars[2].transform.GetChild(0).gameObject.SetActive(false);
}
img-20151030-074753.jpg
(65.7 kB)
Comment
If anyone could please help me if be greatful ty