BaseSpeedSlider.cs 591 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class BaseSpeedSlider : MonoBehaviour
  6. {
  7. Text text;
  8. public static BaseSpeedSlider ins;
  9. void Start()
  10. {
  11. ins = this;
  12. text = this.transform.Find("Text").GetComponent<Text>();
  13. }
  14. public void onSlider()
  15. {
  16. float value = this.GetComponent<Slider>().value;
  17. text.text = "发射速度 " + (value).ToString("#0.00") + "m/s";
  18. }
  19. public float getValue()
  20. {
  21. return this.GetComponent<Slider>().value * 0.5f;
  22. }
  23. }