using Godot; namespace Babushka.scripts.CSharp.Common.CharacterControls; /// /// 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. /// public partial class DetectionCross : Node2D { [Export] private Detector _collider; [Export] private ShapeCast2D _shapeCast2D; [Export] private float _xOffset; [Export] private float _yOffset; /// /// Gets the current look direction of the player and moves the detection shape with it. /// /// public void SetDirection(Vector2 direction) { Vector2 newPos = new Vector2(direction.X * _xOffset, direction.Y * _yOffset); _collider.Position = newPos; _shapeCast2D.TargetPosition = newPos; } }