Fixed spawnable enemies alpha

This commit is contained in:
Marco 2025-09-26 10:53:20 +02:00
commit 6c9222e47e
5 changed files with 252 additions and 162 deletions

View file

@ -41,12 +41,15 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable
{
if (_autoSpawn)
{
SetSpriteAlpha(1);
Alpha = 1.0f;
// SetSpriteAlpha(1);
}
else
{
SetSpriteAlpha(0.5f);
Alpha = 0.5f;
//SetSpriteAlpha(0.5f);
}
QueueRedraw();
}
}
}
@ -59,8 +62,20 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable
{
//GroupName = (string)props["targetname"];
this.AddToGroup("EnemyMarkers");
AutoSpawn = props["autospawn"].AsBool();
_billboard = true;
_autoSpawn = props["autospawn"].AsBool();
if (_autoSpawn)
{
_alpha = 1.0f;
// SetSpriteAlpha(1);
}
else
{
_alpha = 0.5f;
//SetSpriteAlpha(0.5f);
}
var scriptPath = props["resource_path"].AsString();
if (!string.IsNullOrWhiteSpace(scriptPath))
{
@ -73,10 +88,28 @@ public partial class EnemyMarker3D : PreviewMarker3D, IActivable
TargetName = props["targetname"].AsStringName();
Billboard = true;
//QueueRedraw(); // Redraw should be automatic when enemy was changed and texture updated
//MarkerId = props["id"].AsInt32();
}
protected override void QueueRedraw()
{
if (!Engine.IsEditorHint()) return;
if (_autoSpawn)
{
_alpha = 1.0f;
// SetSpriteAlpha(1);
}
else
{
_alpha = 0.5f;
//SetSpriteAlpha(0.5f);
}
base.QueueRedraw();
}
public override void _Ready()
{
base._Ready();