using Core.Utilities; using JetBrains.Annotations; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class HealthHeartState : Singleton { public List selfHeartList; public List oppoHeartList; public Sprite heartBreakImg; protected bool[] selfHeartState; protected bool[] oppoHeartState; // Start is called before the first frame update void Start() { selfHeartState = new bool[selfHeartList.Count]; oppoHeartState = new bool[oppoHeartList.Count]; for( int ti = 0;ti /// 删除一个对应的红心. /// /// public void killHeart( bool opponent) { if (opponent) { for( int ti = 0;ti< oppoHeartState.Length;ti ++) { if( oppoHeartState[ti]) { if (this.heartBreakImg) oppoHeartList[ti].sprite = heartBreakImg; else oppoHeartList[ti].gameObject.SetActive(false); oppoHeartState[ti] = false; return; } } } else { for (int ti = 0; ti < selfHeartState.Length; ti++) { if( selfHeartState[ti]) { if (this.heartBreakImg) selfHeartList[ti].sprite = heartBreakImg; else selfHeartList[ti].gameObject.SetActive(false); selfHeartState[ti] = false; return; } } } } }