7-17-25 @ 3:55am
This commit is contained in:
36
Gameplay/ActorPanel.cs
Normal file
36
Gameplay/ActorPanel.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ActorPanel : Panel
|
||||
{
|
||||
public static ActorPanel _Create(Actor ACTOR)
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/actor_panel.tscn");
|
||||
ActorPanel newActorPanel = scene.Instantiate<ActorPanel>();
|
||||
|
||||
newActorPanel.SetSprite(ACTOR.Texture);
|
||||
newActorPanel.SetMax(ACTOR._healthMax);
|
||||
newActorPanel.SetValue(ACTOR._health);
|
||||
newActorPanel.SetPosition(new Vector2(1500, 0));
|
||||
|
||||
return newActorPanel;
|
||||
}
|
||||
public void SetPosition(Vector2 POSITION)
|
||||
{
|
||||
Position = POSITION;
|
||||
}
|
||||
public void SetSprite(Texture2D TEXTURE)
|
||||
{
|
||||
GetNode<Sprite2D>("Image").Texture = TEXTURE;
|
||||
}
|
||||
public void SetValue(int VALUE)
|
||||
{
|
||||
GetNode<Node2D>("Health").GetNode<RichTextLabel>("Value").Text = VALUE.ToString();
|
||||
GetNode<Node2D>("Health").GetNode<ProgressBar>("Bar").Value = VALUE;
|
||||
}
|
||||
public void SetMax(int MAX)
|
||||
{
|
||||
GetNode<Node2D>("Health").GetNode<RichTextLabel>("Max").Text = MAX.ToString();
|
||||
GetNode<Node2D>("Health").GetNode<ProgressBar>("Bar").MaxValue = MAX;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user