using Pine; using UnityEngine; namespace PineDocs.Examples { public static class PineHud { public static View Create() { var health = P.Source(100); var coins = P.Source(0); return P.Vertical( spacing: 8, childControlWidth: true, childControlHeight: true, childForceExpandHeight: false, sizeDelta: new Vector2(520, 300), children: new[] { P.Text("Game HUD", children: new[] { P.LayoutElement(preferredHeight: 40) }), P.Text( () => $"Health: {health.Value} / 100", children: new[] { P.LayoutElement(preferredHeight: 40) } ), P.Slider( value: new Value(() => health.Value), minValue: 0, maxValue: 100, interactable: false, children: new[] { P.LayoutElement(preferredHeight: 24) } ), P.Text( () => $"Coins: {coins.Value}", children: new[] { P.LayoutElement(preferredHeight: 40) } ), P.Button( "Take 10 damage", interactable: new Value(() => health.Value > 0), onClick: () => health.Value = Mathf.Max(0, health.Value - 10), children: new[] { P.LayoutElement(preferredHeight: 40) } ), P.Button( "Collect a coin", onClick: () => coins.Value++, children: new[] { P.LayoutElement(preferredHeight: 40) } ), } ); } } }