| 12345678910111213141516171819202122232425 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class TargetDistanceSlider : MonoBehaviour
- {
- GameObject target;
- Text text;
- void Start()
- {
- target = GameObject.Find("GameArea/010");
- text = this.transform.Find("Text").GetComponent<Text>();
- }
- public void onSlider()
- {
- float value = this.GetComponent<Slider>().value;
- Vector3 v3 = target.transform.localPosition;
- v3.x = 7.718f + (-17.12f - 7.718f) * value;
- target.transform.localPosition = v3;
- text.text = "箭靶距离 - " + (10f + value * 60f).ToString("#0.00") + "米";
- }
- }
|