123456789101112131415161718192021222324252627282930313233 |
- using System;
- using Game;
- using UnityEngine;
- using UnityEngine.UI;
- namespace Comp
- {
- public class LiftButtonComp : MonoBehaviour
- {
- private Button _button;
- private void Start()
- {
- _button = GetComponent<Button>();
- }
- private void Update()
- {
- if (GameCore.Instance.localPlayer == null) return;
- var lastHpPercent = (float)GameCore.Instance.localPlayer.runTimeHp / GameCore.Instance.localPlayer.hp;
- if (GameCore.Instance.GetCurState() != null && GameCore.Instance.battleState != null &&
- GameCore.Instance.GetCurState() == GameCore.Instance.battleState && GameCore.Instance.liftTimes > 0 &&
- lastHpPercent <= 0.5f)
- {
- _button.interactable = true;
- }
- else
- {
- _button.interactable = false;
- }
- }
- }
- }
|