summaryrefslogtreecommitdiff
path: root/scripts/GUI/Hud.cs
blob: 227ca32314db66ab03ac87659b70016ee7df39bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Runtime.InteropServices;
using Godot;

namespace TheLegendOfGustav.GUI;

public partial class Hud : Node
{
	private TextureProgressBar hpBar;
	private TextureProgressBar mpBar;

	public override void _Ready()
	{
		base._Ready();
		hpBar = GetNode<TextureProgressBar>("VBoxContainer/InfoBar/Stats/MarginContainer/HBoxContainer/AspectRatioContainer/HPbar");
		mpBar = GetNode<TextureProgressBar>("VBoxContainer/InfoBar/Stats/MarginContainer/HBoxContainer/AspectRatioContainer2/MPbar");
	}

	public void OnHealthChanged(int hp, int maxHp)
	{
		hpBar.Value = hp;
		hpBar.MaxValue = maxHp;
	}

	public void OnManaChanged(int mp, int maxMp)
	{
		mpBar.Value = mp;
		mpBar.MaxValue = maxMp;
	}
}