typed Open trigger

This commit is contained in:
MaddoScientisto 2025-06-27 21:28:01 +02:00
commit 4abf28066a
23 changed files with 2018 additions and 1440 deletions

View file

@ -11,6 +11,8 @@ public partial class TriggerArea : Area3D
[Export] public string TargetFunc { get; private set; }
[Export] public string TargetName { get; private set; }
[Export] public ActivationType ActivationType { get; private set; } = ActivationType.Toggle;
public enum TriggerStates
{
READY,
@ -27,6 +29,16 @@ public partial class TriggerArea : Area3D
Target = props["target"];
TargetFunc = props["targetfunc"];
TargetName = props["targetname"];
if (props.TryGetValue("activationtype", out var type))
{
var t = Enum.TryParse(type, true, out ActivationType activationType);
if (t)
{
ActivationType = activationType;
}
}
}
public void _on_ent_entered(Node ent)
@ -72,7 +84,7 @@ public partial class TriggerArea : Area3D
if (t is IActivable activable)
{
GD.Print($"Activating {t.Name}");
activable.Toggle();
activable.Activate(ActivationType);
}
}
}