void LoadProfileData(FishDataObject fish) { profileScreenSprite.sprite = fish.data.profileSprite; nameTMP.text = fish.data.name; profileBlurbScrollRect.verticalNormalizedPosition = 1; blurbTMP.text = fish.data.profileText; _charArray.Clear(); _charArray.Append((int)Mathf.Clamp(fish.data.saveData.numberCaught, 0, 999)); caughtValueTMP.SetCharArray(_charArray.GetArray(), 0, _charArray.count); _charArray.Clear(); _charArray.Append((int)Mathf.Clamp(fish.data.saveData.numberMissed, 0, 999)); missedValueTMP.SetCharArray(_charArray.GetArray(), 0, _charArray.count); _charArray.Clear(); if (fish.data.saveData.timeFirstCaughtHours < 10) { _charArray.Append(0); } _charArray.Append(fish.data.saveData.timeFirstCaughtHours); _charArray.Append(':'); if (fish.data.saveData.timeFirstCaughtMinutes < 10) { _charArray.Append(0); } _charArray.Append(fish.data.saveData.timeFirstCaughtMinutes); timeTMP.SetCharArray(_charArray.GetArray(), 0, _charArray.count); }
public void ShowSuccess(FishDataObject fish, bool goToPhone = false) { bobberAimBehaviour.enabled = false; animator.SetTrigger("ShowSuccess"); profileSpriteRenderer.sprite = fish.data.profileSprite; messageCharArray.Clear(); messageCharArray.Append(fish.data.saveData.numberCaught); messageCharArray.Append(GetNumericSuffix(fish.data.saveData.numberCaught)); messageCharArray.Append(message); messageTextMeshPro.SetCharArray(messageCharArray.GetArray(), 0, messageCharArray.count); // nameCharArray.Clear(); // nameCharArray.Append(fish.data.name); _goToPhone = goToPhone; }
void Update() { // update text probability = Mathf.Lerp(probability, targetProbability, Time.deltaTime * lerpSpeed); if (Mathf.Abs(probability - targetProbability) * 100 < 1f) { probability = targetProbability; } int textProbability = (int)Mathf.Clamp(probability * 100f, 0f, 99f); charArray.Clear(); if (textProbability < 10) { charArray.Append(0); } charArray.Append(textProbability); charArray.Append('%'); probabilityTMPro.SetCharArray(charArray.GetArray(), 0, charArray.count); }