void Start() { startTime = timeBtwCheck; HeartHealthSystem heartHealthSystem = new HeartHealthSystem(10); SetHeartsHealthSystem(heartHealthSystem); }
public void SetHeartsHealthSystem(HeartHealthSystem heartHealthSystem) { this.heartHealthSystem = heartHealthSystem; heartHealthSystemStatic = heartHealthSystem; List <HeartHealthSystem.Heart> heartList = heartHealthSystem.GetHeartList(); int row = 0; int col = 0; int colMax = 5; float rowColSize = 45f; for (int i = 0; i < heartList.Count; i++) { HeartHealthSystem.Heart heart = heartList[i]; Vector2 heartAnchoredPosition = new Vector2(col * rowColSize, -row * rowColSize); CreateHeartImage(heartAnchoredPosition).SetHeartFragments(heart.GetFragmentAmount()); col++; if (col >= colMax) { row++; col = 0; } } heartHealthSystem.OnDamaged += HeartHealthSystem_OnDamaged; heartHealthSystem.OnHealed += HeartHealthSystem_OnHealed; heartHealthSystem.OnDead += HeartHealthSystem_OnDead; }
public void SetHeartHealthSystem(HeartHealthSystem system) { healthSystem = system; List <HeartHealthSystem.Heart> heartlist = healthSystem.getHeartList(); Vector2 anchoredPos = new Vector2(0, 0); for (int i = 0; i < heartlist.Count; i++) { HeartHealthSystem.Heart heart = heartlist[i]; CreateHeart(anchoredPos).setHeartFragment(heart.GetFragments()); anchoredPos += new Vector2(55, 0); } healthSystem.onDamaged += HeartHealthSystem_onDamaged; healthSystem.onHeal += HeartHealthSystem_onHeal; }
public void SetHeartHealthSystem(HeartHealthSystem heartsHealthSystem) { this.heartHealthSystem = heartsHealthSystem; heartHealthSystemStatic = heartsHealthSystem; Vector2 heartAnchoredPosition = new Vector2(-350, 250); List <HeartHealthSystem.Heart> heartList = heartHealthSystem.GetHeartList(); for (int i = 0; i < heartList.Count; i++) { HeartHealthSystem.Heart heart = heartList[i]; CreateHeartImage(heartAnchoredPosition).SetHeartFragment(heart.GetFragmentAmount()); heartAnchoredPosition += new Vector2(40, 0); } heartsHealthSystem.OnDamaged += HeartsHealthSystem_OnDamaged; heartsHealthSystem.OnHealed += HeartsHealthSystem_OnHealed; heartsHealthSystem.OnDead += HeartsHealthSystem_OnDead; }
void Start() { HeartHealthSystem hhs = new HeartHealthSystem(4); SetHeartHealthSystem(hhs); }
void Start() { health = GameObject.FindGameObjectWithTag("Player").GetComponent <HeartHealthSystem>(); audioManager = FindObjectOfType <AudioManager>(); }
public void SetHealthBar(float heartCount) { heartImagelist = new List <HeartImage>(); healthSystem = new HeartHealthSystem((int)heartCount); SetHeartHealthSystem(healthSystem); }