You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.1 KiB
30 lines
1.1 KiB
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<PointsBar>();
|
|
movementRight = transform.GetChild(1).GetComponent<PointsBar>();
|
|
movementText = transform.GetChild(2).GetComponent<TMP_Text>();
|
|
}
|
|
public void ChangeMovement(int amount, int currentMovement, float ratio)
|
|
{
|
|
movementText.GetComponent<TMP_Text>().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);
|
|
}
|
|
}
|