Initial commit
This commit is contained in:
24
scripts/PlayerGui.cs
Normal file
24
scripts/PlayerGui.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public class PlayerGui : CanvasLayer
|
||||
{
|
||||
|
||||
ProgressBar healtbar;
|
||||
public override void _Ready()
|
||||
{
|
||||
healtbar = GetNode<ProgressBar>("Control/HealthBar");
|
||||
}
|
||||
|
||||
public void OnUpdatePlayerGui(Player player)
|
||||
{
|
||||
// Update healthbar
|
||||
if(healtbar != null)
|
||||
{
|
||||
healtbar.MaxValue = player.health.max;
|
||||
healtbar.MinValue = player.health.min;
|
||||
healtbar.Value = player.health.value;
|
||||
} else { GD.Print("WARNING: Healtbar not set!"); }
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user