mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:55:35 +00:00
32 lines
No EOL
686 B
C#
32 lines
No EOL
686 B
C#
using Godot;
|
|
|
|
namespace Cirno.Scripts.Components.Actors;
|
|
|
|
public partial class PlayerCrosshairProvider : Node2D
|
|
{
|
|
[Export]
|
|
public AnimatedSprite2D AnimatedSprite { get; private set; }
|
|
|
|
[Export]
|
|
public float CrosshairDistance { get; private set; }
|
|
|
|
public void UpdatePosition(Vector2 facingDirection)
|
|
{
|
|
AnimatedSprite.Position = CalculateCrosshairPosition(facingDirection);
|
|
}
|
|
|
|
private Vector2 CalculateCrosshairPosition(Vector2 facingDirection)
|
|
{
|
|
return facingDirection * CrosshairDistance;
|
|
}
|
|
|
|
public void Show()
|
|
{
|
|
AnimatedSprite.Show();
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
AnimatedSprite.Hide();
|
|
}
|
|
} |