parent
7ffbb8e68d
commit
9e0e87ef17
@ -1,41 +0,0 @@
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
||||
|
||||
public partial class RaycastDetector : RayCast2D
|
||||
{
|
||||
[Export] private bool _active = true;
|
||||
|
||||
private DetectableInteractionArea? _lastDetected;
|
||||
|
||||
public bool IsActive
|
||||
{
|
||||
get => _active;
|
||||
set
|
||||
{
|
||||
Visible = value;
|
||||
_active = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
if (!_active)
|
||||
return;
|
||||
|
||||
if (IsColliding())
|
||||
{
|
||||
if (GetCollider() is DetectableInteractionArea interactionArea)
|
||||
{
|
||||
if (_lastDetected != null && _lastDetected != interactionArea)
|
||||
{
|
||||
_lastDetected.NoLongerDetected();
|
||||
}
|
||||
|
||||
GD.Print("Colliding with: " + interactionArea.GetParent().Name);
|
||||
_lastDetected = interactionArea;
|
||||
interactionArea.Detected();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
uid://b4n0nlu4ckqga
|
||||
Loading…
Reference in new issue