using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; public class CombatPanel : MonoBehaviour { [SerializeField] private Slider _hp; [SerializeField] private Slider _exp; [SerializeField] private Text _lv; [SerializeField] private RogenPanel _rogenPanel; [SerializeField] private List _combatItems = new List(); [SerializeField] private GameObject item; [SerializeField] private Transform itemParent; public void StartPanel() { _rogenPanel.gameObject.SetActive(false); if (_combatItems.Count>0) { for (int i = 0; i < _combatItems.Count; i++) { Destroy(_combatItems[i].gameObject); } } _combatItems = new List(); } public void ResetItem() { foreach (var state in BattleManager.ins.SkillStates) { var bo = _combatItems.Any(c => c.State == state); if (!bo) { var obj = Instantiate(item, itemParent); obj.SetActive(true); obj.GetComponent().SetData(state); _combatItems.Add(obj.GetComponent()); } } } public void OpenRogenPanel() { _rogenPanel.gameObject.SetActive(true); _rogenPanel.SetResetIndex(1); _rogenPanel.InitData(); } public void CloseRogenPanel() { _rogenPanel.gameObject.SetActive(false); } public void ResetHp() { _hp.value = (BattleManager.ins.HP-(float)BattleManager.ins.Injured) / (float)BattleManager.ins.HP; } public void ResetExp() { _exp.value = (float)BattleManager.ins.Exp / BattleManager.ins.MaxExp; _lv.text = BattleManager.ins.ExpLevel.ToString(); } }