Camera triggers

This commit is contained in:
Marco 2025-06-30 10:02:37 +02:00
commit b0d0161ab0
8 changed files with 1136 additions and 1074 deletions

View file

@ -1,4 +1,6 @@
using System.Linq;
using System;
using System.Linq;
using Cirno.Scripts.Utils;
using Godot;
using Godot.Collections;
@ -33,6 +35,14 @@ public partial class Switch3D : Interactable3D
{
RequirementKeys = [prop];
}
if (props.TryGetValue("activationtype", out var type))
{
var t = Enum.TryParse(type, true, out ActivationType activationType);
if (t)
{
ActivationType = activationType;
}
}
//TargetFunc = props["targetfunc"];
//TargetName = props["targetname"];
}
@ -51,7 +61,7 @@ public partial class Switch3D : Interactable3D
if (!string.IsNullOrWhiteSpace(TargetGroup))
{
UseTargets(this, TargetGroup);
ActivationHelper.UseTargets(this, TargetGroup);
}
return Targets.Aggregate(success, (current, target) => ActivateTarget(target, activationTypeToUse) | success);
@ -64,19 +74,19 @@ public partial class Switch3D : Interactable3D
return true;
}
private void UseTargets(Node activator, string target)
{
GD.Print($"Trying to use targets called: {target}");
var targetList = GetTree().GetNodesInGroup(target);
foreach (var t in targetList)
{
//string f;
GD.Print($"Trying to use {t.Name}");
if (t is IActivable activable)
{
GD.Print($"Activating {t.Name}");
activable.Toggle();
}
}
}
// private void UseTargets(Node activator, string target)
// {
// GD.Print($"Trying to use targets called: {target}");
// var targetList = activator.GetTree().GetNodesInGroup(target);
// foreach (var t in targetList)
// {
// //string f;
// GD.Print($"Trying to use {t.Name}");
// if (t is IActivable activable)
// {
// GD.Print($"Activating {t.Name}");
// activable.Toggle();
// }
// }
// }
}