| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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 (TextAutoLanguage2.GetLanguage() == LanguageEnum.Chinese) {
- speedLabel.transform.localPosition = new Vector3(-0.08f, 2.95f, -0.1f);
- speedLabel.transform.localScale = new Vector3(0.0653898f, 0.1120968f, 0.93414f);
- speedLabel.text = "速度 千米/小时";
- speedText.transform.localPosition = new Vector3(-0.85f, 2.86f, -0.1f);
- } else {
- speedLabel.transform.localPosition = new Vector3(-0.06f, 2.95f, -0.1f);
- speedLabel.transform.localScale = new Vector3(0.0535241f, 0.0917556f, 0.76463f);
- speedLabel.text = "Arrow Speed kmph";
- speedText.transform.localPosition = new Vector3(0.84f, 2.95f, -0.1f);
- }
- }
- 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;
- }
- }
|