Rotate bullet pattern to face parent

This commit is contained in:
Marco 2025-07-09 12:00:23 +02:00
commit 7d267c406d
19 changed files with 1325 additions and 1245 deletions

View file

@ -9,7 +9,7 @@ namespace Cirno.Scripts.Interactables;
[Tool]
public partial class Switch3D : Interactable3D
{
[Export] public string TargetGroup { get; private set; }
[Export] public string TargetGroup { get; protected set; }
[Export] public Node Target { get; set; }
[Export] public Array<Node> Targets { get; private set; } = [];
[Export] public ActivationType ActivationType { get; set; } = ActivationType.Toggle;
@ -31,17 +31,17 @@ public partial class Switch3D : Interactable3D
_denySound = GetNodeOrNull<AudioStreamPlayer>(_denySoundName);
}
public void _func_godot_apply_properties(Dictionary<string, string> props)
public virtual void _func_godot_apply_properties(Dictionary<string, Variant> props)
{
TargetGroup = props["target"];
TargetGroup = props["target"].AsString();
if (props.TryGetValue("key", out var prop))
{
RequirementKeys = [prop];
RequirementKeys = [prop.AsString()];
}
if (props.TryGetValue("activationtype", out var type))
{
var t = Enum.TryParse(type, true, out ActivationType activationType);
var t = Enum.TryParse(type.AsString(), true, out ActivationType activationType);
if (t)
{
ActivationType = activationType;
@ -68,11 +68,11 @@ public partial class Switch3D : Interactable3D
if (!string.IsNullOrWhiteSpace(TargetGroup))
{
ActivationHelper.UseTargets(this, TargetGroup, activationType);
success |= ActivationHelper.UseTargets(this, TargetGroup, activationType);
}
var result = Targets.Aggregate(success,
(current, target) => ActivateTarget(target, activationTypeToUse) | success);
(current, target) => current | ActivateTarget(target, activationTypeToUse));
if (result)
{