public void SetObjectiverProgress(ObjectiveProgress objectiveProgress) { _objectiveProgress = objectiveProgress; _currentProgress = _objectiveProgress.Progress; _currentProgressValue = _objectiveProgress.ProgressValue(); _cellContent.SetActive(true); _descriptionLabel.text = _objectiveProgress.FullDescription(); _progressLabel.text = _currentProgress + "/" + _objectiveProgress.TargetValue(); _progressBarImage.fillAmount = _currentProgressValue; }
public IEnumerator<float> UpdateNewObjectiveValues(ObjectiveProgress objectiveProgress) { for (float timer = 0; timer < _progressAnimationDuration; timer += Time.deltaTime) { float progress = timer / _progressAnimationDuration; _progressLabel.text = ((int)Mathf.Lerp(_currentProgress, objectiveProgress.Progress, progress)).ToString() + "/" + _objectiveProgress.TargetValue(); _progressBarImage.fillAmount = Mathf.Lerp(_currentProgressValue, objectiveProgress.ProgressValue(), progress); Debug.Log("progress: " + progress); yield return 0f; } _objectiveProgress = objectiveProgress; _currentProgress = _objectiveProgress.Progress; _currentProgressValue = _objectiveProgress.ProgressValue(); _progressLabel.text = _currentProgress + "/" + _objectiveProgress.TargetValue(); _progressBarImage.fillAmount = _currentProgressValue; }