using Godot; using System; public partial class ActorPanel : Panel { public bool _hovered = false; public Actor _actor; public static ActorPanel _Create(Actor ACTOR) { PackedScene scene = ResourceLoader.Load("res://Gameplay/actor_panel.tscn"); ActorPanel newActorPanel = scene.Instantiate(); newActorPanel._actor = ACTOR; newActorPanel.SetSprite(newActorPanel._actor.GetNode("Sprite").Texture); newActorPanel.SetMax(newActorPanel._actor._healthMax); newActorPanel.SetValue(newActorPanel._actor._health); newActorPanel.SetPosition(new Vector2(50, 50)); return newActorPanel; } public void SetPosition(Vector2 POSITION) { Position = POSITION; } public void SetSprite(Texture2D TEXTURE) { GetNode("Image").Texture = TEXTURE; } public void SetValue(int VALUE) { GetNode("Health").GetNode("Value").Text = VALUE.ToString(); GetNode("Health").GetNode("Bar").Value = VALUE; } public void SetMax(int MAX) { GetNode("Health").GetNode("Max").Text = MAX.ToString(); GetNode("Health").GetNode("Bar").MaxValue = MAX; } private void OnMouseEntered() { _hovered = true; } private void OnMouseExited() { _hovered = false; } }