using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; /* 静止靶场景的小黑板 */ public class Billboard : MonoBehaviour { public TextMeshProUGUI speedText; public TextMeshProUGUI speedLabel; private float arrowSpeed; private float arrowSpeedScale = 1; public static Billboard ins; void Awake() { ins = this; if (TextAutoLanguage.GetLanguage() == LanguageEnum.Chinese) { speedLabel.text = "速度 千米/时"; Vector3 lpos = speedText.transform.localPosition; lpos.x = -0.61f; lpos.y = 2.86f; speedText.transform.localPosition = lpos; } else { speedLabel.text = "Speed KM/H"; } } void OnDestroy() { if (ins == this) ins = null; } /**speed m/s */ public void SetArrowSpeed(float value) { //转km/h this.arrowSpeed = value * 3600f / 1000f; } public void SetArrowSpeedScale(float value) { this.arrowSpeedScale = value; } public void ShowSpeed() { if (speedText) { speedText.text = (this.arrowSpeed * this.arrowSpeedScale).ToString($"f{CommonConfig.arrowSpeedPrecision}"); } } public void SetShootSpeedText(string text) { if (speedText) { speedText.text = text; } } public string GetShootSpeedText() { return speedText.text; } }