cirnogodot/Scripts/Actors/ElevatorProxy3D.cs

36 lines
853 B
C#
Raw Permalink Normal View History

2025-06-13 18:34:24 +02:00
using Godot;
2025-06-18 11:33:27 +02:00
using Godot.Collections;
2025-06-13 18:34:24 +02:00
namespace Cirno.Scripts.Actors;
2025-06-18 11:33:27 +02:00
[Tool]
2025-06-13 18:34:24 +02:00
public partial class ElevatorProxy3D : Path3D, IActivable
{
2025-06-18 11:33:27 +02:00
[Export] public StringName TargetName { get; set; }
2025-06-13 18:34:24 +02:00
[Export] public Elevator3D Elevator { get; private set; }
public bool Activate(ActivationType activationType = ActivationType.Toggle)
{
2025-06-18 11:33:27 +02:00
if (Engine.IsEditorHint()) return false;
2025-06-13 18:34:24 +02:00
return Elevator.Activate(activationType);
}
2025-06-18 11:33:27 +02:00
public void Toggle()
{
this.Activate();
}
public void _func_godot_apply_properties(Dictionary props)
{
TargetName = (string)props["targetname"];
}
public override void _Ready()
{
if (Engine.IsEditorHint()) return;
if (!string.IsNullOrWhiteSpace(TargetName))
{
this.AddToGroup(TargetName);
}
}
2025-06-13 18:34:24 +02:00
}