Files
hotdesking/Gameplay/ManagerPanel.cs
2025-08-04 02:42:51 -04:00

44 lines
1.1 KiB
C#

using Godot;
using System;
public partial class ManagerPanel : Panel
{
public bool _hovered = false;
public void SetManager(Manager MANAGER)
{
SetPosition(new Vector2(100, 150));
SetSprite(MANAGER._imagePath);
SetValue(MANAGER._health);
SetMax(MANAGER._healthMax);
}
public void SetPosition(Vector2 POSITION)
{
Position = POSITION;
}
public void SetSprite(string IMAGEPATH)
{
GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>(IMAGEPATH);
}
public void SetValue(int VALUE)
{
GetNode<Control>("Health").GetNode<RichTextLabel>("Value").Text = VALUE.ToString();
GetNode<Control>("Health").GetNode<ProgressBar>("Bar").Value = VALUE;
}
public void SetMax(int MAX)
{
GetNode<Control>("Health").GetNode<RichTextLabel>("Max").Text = MAX.ToString();
GetNode<Control>("Health").GetNode<ProgressBar>("Bar").MaxValue = MAX;
}
private void OnMouseEntered()
{
_hovered = true;
}
private void OnMouseExited()
{
_hovered = false;
}
}