mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 14:43:47 +00:00
Made things into tools to display enemy icons on spawner marks
This commit is contained in:
parent
f460103239
commit
c00d298443
49 changed files with 174 additions and 55 deletions
42
Scripts/Actors/RogueliteEnemySpawner.cs
Normal file
42
Scripts/Actors/RogueliteEnemySpawner.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
1
Scripts/Actors/RogueliteEnemySpawner.cs.uid
Normal file
1
Scripts/Actors/RogueliteEnemySpawner.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://8umfjejbkcsm
|
||||
Loading…
Add table
Add a link
Reference in a new issue