Hi everyone, I would need some help with scripting.
I have a casual game with 1000 levels.
I am trying to build a refill system, that fills up when reached level 100, then give a reward, and start filing over again till level 200, and the same thing repeats again.
I can fill the bar till lv 100, but how to restart it again and again?
Thank you for any useful input!
here is my script:
void Setlevelprogress()
{
float currentlevelvalue = prefmanager.instance.Getlevelsvalue();
levelValue.text = currentlevelvalue.ToString();
var fillvalue = currentlevelvalue / 100f;
Levelfillbar.fillAmount = fillvalue;
if (levelvalue == 101)
{
Debug.Log(“reached lv 100”);
//restart filling
//some animation
List fromPositions = new List();
for (int i = 0; i < categoryCoinsAwarded; i++)
{
fromPositions.Add(categoryCoinPrizeIcon);
SoundManager.instance.PlayRewardfalSound();
}
CoinController.Instance.AnimateCoins(categoryCoinsAmountFrom, categoryCoinsAmountTo, fromPositions);
categoryCoinPrizeIcon.gameObject.SetActive(false);
coinController.AnimateCoins(categoryCoinsAmountFrom, categoryCoinsAmountTo, fromPositions);
}
}