Billboard.cs 525 B

123456789101112131415161718192021222324
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using TMPro;
  5. public class Billboard : MonoBehaviour
  6. {
  7. public TextMeshProUGUI speedText;
  8. static Billboard ins;
  9. void Awake() {
  10. ins = this;
  11. }
  12. /**speed m/s */
  13. public static void ShowSpeed(float speed) {
  14. //转km/h
  15. speed = speed * 3600f / 1000f;
  16. if (ins && ins.speedText) {
  17. ins.speedText.text = speed.ToString($"f{CommonConfig.arrowSpeedPrecision}");
  18. }
  19. }
  20. }