| 123456789101112131415161718 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class TargetDistanceSlider : MonoBehaviour
- {
- public void onSlider()
- {
- float distance = this.GetComponent<Slider>().value * 70f;
- GameObject targetBodyNode = GameObject.Find("GameArea/TargetObject");
- if (targetBodyNode == null) return;
- TargetBody target = targetBodyNode.GetComponentInChildren<TargetBody>();
- target.SetDistance(distance);
- Text text = this.transform.Find("Text").GetComponent<Text>();
- text.text = "箭靶距离 - " + distance.ToString("#0.00") + "米";
- }
- }
|