void GainTweenDone() { //Pass in the is animationg bool to mark if this is the first time we are calculating animation. //if this is the first time then the animation should be set to false. and the fals value shoudl pass in to calculate accordingly. isAnimating = true; CalculatePieAnimation(); //Now lets start the pie chart animation after the icon slams in. PieIntroTween.Play(true); BGTween.Play(true); AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotSelect); _levelCouter++; }
void CalculatePieAnimation() { //If we have more levels to count, start from 0 and end at 1. if (currentLevel == _levelCouter) { //Set the two and from positions of the alpha to the percentages. BGTween.from = previousPercent; BGTween.to = currentPercent; //Calculate the delta in remaining xp //The delta will be added along with the animations deltaRemain = remainingXP; //Set some labels. LevelCount.text = currentLevel.ToString(); XPFalta.text = string.Format("{0:#,#,#}", previousRemain); XPCompletion.text = string.Format("{0:#,#,#}", currentCompletionXP); //Set the labels. SetPieFill(previousPercent); } if (currentLevel > _levelCouter) { //Set the two and from positions of the alpha to the percentages. BGTween.from = previousPercent; BGTween.to = 1.0f; deltaRemain = currentCompletionXP; LevelCount.text = _levelCouter.ToString(); XPCompletion.text = string.Format("{0:#,#,#}", currentCompletionXP); XPFalta.text = " - "; //Since we are upping a whole level here, set previous percent to 0. previousPercent = 0.0f; } //The pie BG animation PieIntroTween.Reset(); //The alpha animation for the pie chart BGTween.Reset(); }