Spawn markers in editor

This commit is contained in:
Marco 2025-09-22 16:33:10 +02:00
commit 479df3c7c4
8 changed files with 150 additions and 76 deletions

View file

@ -2,6 +2,7 @@
using Cirno.Scripts.Resources;
using Cirno.Scripts.Utils;
using Godot;
using Godot.Collections;
namespace Cirno.Scripts.Actors;
@ -52,6 +53,26 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable
private EnemyProxy3D _spawnedEnemy;
public void _func_godot_apply_properties(Dictionary<string, Variant> props)
{
//GroupName = (string)props["targetname"];
this.AddToGroup("EnemyMarkers");
AutoSpawn = props["autospawn"].AsBool();
var scriptPath = props["resource_path"].AsString();
if (!string.IsNullOrWhiteSpace(scriptPath))
{
Enemy = GD.Load<EnemyResource>(scriptPath);
}
else
{
GD.PushWarning($"Spawner {this.Name} has no enemy assigned");
}
Billboard = true;
//MarkerId = props["id"].AsInt32();
}
public override void _Ready()
{
base._Ready();