/// //Prueba/////////////////// /*private void Update() * { * if(Input.GetKeyDown(KeyCode.K)) * { * healthHeartsSystem.Damage(1); * } * if (Input.GetKeyDown(KeyCode.L)) * { * healthHeartsSystem.Damage(2); * } * if (Input.GetKeyDown(KeyCode.I)) * { * healthHeartsSystem.Heal(1); * } * if (Input.GetKeyDown(KeyCode.O)) * { * healthHeartsSystem.Heal(3); * } * }*/ /// //Prueba/////////////////// public void SetHealthHeartsSystem(HealthHeartsSystem healthHeartsSystem) { this.healthHeartsSystem = healthHeartsSystem; healthHeartsSystemStatic = healthHeartsSystem; List <HealthHeartsSystem.Heart> heartList = healthHeartsSystem.GetHeartList(); int row = 0; int col = 0; int colMax = numberOfHeartsPerRow; float rowColSize = distanceBetweenHeartsXY; for (int i = 0; i < heartList.Count; i++) { HealthHeartsSystem.Heart heart = heartList[i]; Vector2 heartAnchoredPosition = new Vector2(col * rowColSize, -row * rowColSize); CreateHeartImage(heartAnchoredPosition).SetHeartFragment(heart.GetFragmentAmount()); col++; if (col >= colMax) { row++; col = 0; } } healthHeartsSystem.OnDamaged += HealthHeartsSystem_OnDamaged; healthHeartsSystem.OnHealed += HealthHeartsSystem_OnHealed; healthHeartsSystem.OnDead += HealthHeartsSystem_OnDead; }
private void Start() { InvokeRepeating("HealingAnimatedPeriodic", 0, 0.05f); HealthHeartsSystem healthHeartsSystem = new HealthHeartsSystem(initialHeartNumber); SetHealthHeartsSystem(healthHeartsSystem); }