mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:55:35 +00:00
41 lines
No EOL
939 B
C#
41 lines
No EOL
939 B
C#
using Cirno.Scripts.Activables;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.Utils;
|
|
|
|
[Tool]
|
|
public partial class TeleporterLinker : Node2D
|
|
{
|
|
private Teleporter _teleporter;
|
|
|
|
[Export] public Color Color { get; set; } = Colors.Blue;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_teleporter = GetParentOrNull<Teleporter>();
|
|
}
|
|
|
|
public override void _Draw()
|
|
{
|
|
if (!Engine.IsEditorHint())
|
|
return;
|
|
if (_teleporter is null) return;
|
|
if (!_teleporter.IsEnabled) return;
|
|
if (_teleporter.Target is null) return;
|
|
|
|
Vector2 start = _teleporter.GlobalPosition;
|
|
Vector2 end = _teleporter.Target.GlobalPosition;
|
|
|
|
DrawLine(ToLocal(start), ToLocal(end) + new Vector2(4,4), Color, 2.0f);
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if (Engine.IsEditorHint())
|
|
{
|
|
QueueRedraw();
|
|
}
|
|
}
|
|
|
|
|
|
} |