Files
kziolkowski 8f097de476 :memo::fire:🔨
- removed a lot of unnecessary code
- Made a minimal working version
- Added documentation
2025-10-24 15:13:35 +02:00

22 lines
732 B
C#

using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
/// <summary>
/// Moves the Detector to the position in accordance with the player view to limit the player's range of actions to the ones in front of them.
/// </summary>
public partial class DetectionCross : Node2D
{
[Export] private Detector _detector;
[Export] private float _xOffset;
[Export] private float _yOffset;
/// <summary>
/// Gets the current look direction of the player and moves the detection shape with it.
/// </summary>
/// <param name="direction"></param>
public void SetDirection(Vector2 direction)
{
_detector.Position = new Vector2(direction.X * _xOffset, direction.Y * _yOffset);
}
}