using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.PlayerLoop; using Random = System.Random; using TMPro; namespace MoreMountains.Tools { /// /// A floating text variant using TextMeshPro instead of regular TextMesh /// public class MMFloatingTextMeshPro : MMFloatingText { [Header("TextMeshPro")] /// the TextMeshPro object to use to display values public TextMeshPro TargetTextMeshPro; /// /// On init we grab our TMP's color /// protected override void Initialization() { base.Initialization(); _initialTextColor = TargetTextMeshPro.color; } /// /// Sets the TMP's value /// /// public override void SetText(string newValue) { TargetTextMeshPro.text = newValue; } /// /// Sets the color of the target TMP /// /// public override void SetColor(Color newColor) { TargetTextMeshPro.color = newColor; } /// /// Sets the opacity of the target TMP /// /// public override void SetOpacity(float newOpacity) { _newColor = TargetTextMeshPro.color; _newColor.a = newOpacity; TargetTextMeshPro.color = _newColor; } } }