public void setMaxHearts(int maxHearts) { this.maxHearts = Math.Max(1, maxHearts); if (heartUIEmpty != null) { float height = heartUIEmpty.RectSize.y; heartUIEmpty.Set("rect_size", new Vector2(this.maxHearts * 15, height)); } }
public void setHearts(int hearts) { this.hearts = Math.Max(0, Math.Min(hearts, maxHearts)); if (heartUIFull != null) { float height = heartUIFull.RectSize.y; heartUIFull.Set("rect_size", new Vector2(this.hearts * 15, height)); //heartUIFull.RectSize.x = hearts * 15; } }
public void setHearts(int value) { this.hearts = Mathf.Clamp(value, 0, maxHearts); // if (label != null){ // label.Text = "HP = " + hearts.ToString(); // } if (heartUIFull != null) { var rectSize = new Vector2(); rectSize.x = hearts * 15; rectSize.y = 11; heartUIFull.Set("rect_size", rectSize); } }