37 lines
798 B
C#
37 lines
798 B
C#
using Godot;
|
|
|
|
public partial class Robot : Button
|
|
{
|
|
// Called when the node enters the scene tree for the first time.
|
|
public override void _Ready()
|
|
{
|
|
m_TextureRect = GetNode<TextureRect>("%TextureRect");
|
|
m_Label = GetNode<Label>("%Label");
|
|
}
|
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
public override void _Process(double delta)
|
|
{
|
|
if (m_TextureRect != null)
|
|
m_TextureRect.Texture = Texture;
|
|
if (m_Label != null)
|
|
m_Label.Text = Name;
|
|
}
|
|
|
|
[Export]
|
|
public Texture2D Texture
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Export]
|
|
public string RobotName
|
|
{
|
|
get;
|
|
set;
|
|
} = "Robot";
|
|
|
|
private Label m_Label;
|
|
private TextureRect m_TextureRect;
|
|
} |