mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 10:55:55 +00:00
42 lines
No EOL
896 B
C#
42 lines
No EOL
896 B
C#
using Cirno.Scripts.Resources;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.Actors;
|
|
|
|
[Tool]
|
|
public partial class RogueliteEnemySpawner : Marker2D
|
|
{
|
|
private EnemyResource _enemy;
|
|
|
|
[Export]
|
|
public EnemyResource Enemy
|
|
{
|
|
get => _enemy;
|
|
set
|
|
{
|
|
_enemy = value;
|
|
if (Engine.IsEditorHint())
|
|
{
|
|
QueueRedraw();
|
|
}
|
|
}
|
|
}
|
|
|
|
[ExportToolButton("Update Icon")] public Callable RedrawButton => Callable.From(Redraw);
|
|
|
|
public override void _Draw()
|
|
{
|
|
if (!Engine.IsEditorHint()) return;
|
|
if (Enemy is null) return;
|
|
if (Enemy.IconSprite is null) return;
|
|
|
|
|
|
|
|
DrawTexture(Enemy.IconSprite, - new Vector2(_enemy.IconSprite.GetWidth() / 2f, _enemy.IconSprite.GetHeight() / 2f));
|
|
}
|
|
|
|
private void Redraw()
|
|
{
|
|
QueueRedraw();
|
|
}
|
|
} |