public void SetHeartsHealthSystem(HeartsHealthSystem heartsHealthSystem) { this.heartsHealthSystem = heartsHealthSystem; heartsHealthSystemStatic = heartsHealthSystem; List <HeartsHealthSystem.Heart> heartList = heartsHealthSystem.GetHeartList(); int row = 0; int col = 0; int colMax = 5; float rowColSize = 30f; for (int i = 0; i < heartList.Count; i++) { HeartsHealthSystem.Heart heart = heartList[i]; Vector2 heartAnchoredPosition = new Vector2(col * rowColSize, -row * rowColSize); CreateHeartImage(heartAnchoredPosition).SetHeartFraments(heart.GetFragmentAmount()); col++; if (col >= colMax) { row++; col = 0; } } heartsHealthSystem.OnDamaged += HeartsHealthSystem_OnDamaged; heartsHealthSystem.OnHealed += HeartsHealthSystem_OnHealed; heartsHealthSystem.OnDead += HeartsHealthSystem_OnDead; }
public void SetHeartsHealthSystem(HeartsHealthSystem heartsHealthSystem) { this.heartsHealthSystem = heartsHealthSystem; heartsHealthSystemStatic = heartsHealthSystem; List <HeartsHealthSystem.Heart> _heartList = heartsHealthSystem.GetHeartList(); int _row = 0; int _col = 0; const int colMax = 10; const float rowColSize = 30f; foreach (var heart in _heartList) { Vector2 _heartAnchoredPosition = new Vector2(_col * rowColSize, -_row * rowColSize); CreateHeartImage(_heartAnchoredPosition).SetHeartFraments(heart.GetFragmentAmount()); _col++; if (_col >= colMax) { _row++; _col = 0; } } heartsHealthSystem.OnDamaged += HeartsHealthSystem_OnDamaged; heartsHealthSystem.OnHealed += HeartsHealthSystem_OnHealed; heartsHealthSystem.OnDead += HeartsHealthSystem_OnDead; }
public void SetHeartsHealthSystem(HeartsHealthSystem heartsHealthSystem) { List <HeartsHealthSystem.Heart> heartList = heartsHealthSystem.GetHeartList(); int heartOffset = 42; this.heartsHealthSystem = heartsHealthSystem; heartsHealthSystemStatic = heartsHealthSystem; for (int i = 0; i < heartList.Count; i++) { HeartImage newHeart = CreateHeart(new Vector2(i * heartOffset, 0)); newHeart.SetValue(heartList[i].GetValue()); } heartsHealthSystem.OnDamaged += RefreshHearts; heartsHealthSystem.OnHealed += RefreshHearts; }
public void SetHeartsHealthSystem(HeartsHealthSystem heartsHealthSystem) { this.heartsHealthSystem = heartsHealthSystem; List <HeartsHealthSystem.Heart> heartList = heartsHealthSystem.GetHeartList(); Vector2 heartAnchorePosition = new Vector2(0, 0); for (int i = 0; i < heartList.Count; i++) { HeartsHealthSystem.Heart heart = heartList[i]; CreateHeartImage(heartAnchorePosition).SetHeartValue(heart.GetValue()); heartAnchorePosition += new Vector2(OFFSET, 0); } heartsHealthSystem.onDamaged += RefreshAllHearts; heartsHealthSystem.onHealed += HeakthSystem_OnHealed; heartsHealthSystem.onDead += DeadMessage; }