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 void Start() { binder = transform.parent.GetComponent <UIDataBinder>(); killIndicatorObject = FindObjectOfType <KillIndicator>().GetIndicateObject(); coinIndicatorObject = FindObjectOfType <CoinIndicator>().GetIndicateObject(); killIndicator = killIndicatorObject.GetComponent <KillIndicator>(); coinIndicator = coinIndicatorObject.GetComponent <CoinIndicator>(); Apply(); }