public void Apply() { binder = GetComponentInParent <UIDataBinder>(); experiencePoints = binder.GetExperiencePoints(); levelIndicator = levelIndicatorObject.GetComponent <LevelIndicator>(); levelIndicator.ApplyChanges(experiencePoints.level); controller.SetFill(experiencePoints.currentProgress); switch (controller.FillType) { case BarFillType.Static: binder.SaveExperience(); controller.SetFill(experiencePoints.currentProgress); controller.UpdateIndicator(experiencePoints.level); break; case BarFillType.Animated: if (experiencePoints.nextProgress != experiencePoints.currentProgress) { StartCoroutine(AnimateBar()); } break; default: throw new System.Exception("LevelBarController::Apply() called BarFillController::FillType and it returned null."); } }
private IEnumerator AnimateBar() { //Wait half seconds yield return(new WaitForSeconds(0.5f)); //Start XP Text Animation controller.SetXPText(experiencePoints.claimedExperiencePoints); //Set Next Data binder.SaveExperience(); //Update XP Cache experiencePoints = binder.GetExperiencePoints(); //Wait half seconds yield return(new WaitForSeconds(0.5f)); //Call Animation StartCoroutine(controller.AnimateFill(experiencePoints.currentProgress)); }
private void ControlState() { if (isConnected) { Item[] items = manager.GetItems(); int level = binder.GetExperiencePoints().level; foreach (var item in items) { int itemLevel = item.Data.mapData.basicData.requirement; if (itemLevel <= level) { item.SetItemState(ItemState.Unlocked); item.ApplyIconVisual(); } else { item.SetItemState(ItemState.Locked); item.ApplyIconVisual(); } } } }