using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class MovementBar : MonoBehaviour { PointsBar movementLeft; PointsBar movementRight; TMP_Text movementText; void Start() { movementLeft = transform.GetChild(0).GetComponent(); movementRight = transform.GetChild(1).GetComponent(); movementText = transform.GetChild(2).GetComponent(); } public void ChangeMovement(int amount, int currentMovement, float ratio) { movementText.GetComponent().text = currentMovement.ToString(); // 更新行动点数 movementLeft.ChangeUI(ratio); // 更新行动条 movementRight.ChangeUI(ratio); // 更新行动条 } public void SetMovementActive(bool value) { movementLeft.gameObject.SetActive(value); movementRight.gameObject.SetActive(value); movementText.gameObject.SetActive(value); } }