using AceField.Scripts.Effects; using AceField.Scripts.Logic; using Godot; namespace AceField.Scripts; public partial class Player : CharacterBody2D { private int _currentPlayerId = 1; [Export] public float MaxSpeed = 400f; [Export] public float Acceleration = 500f; [Export] public float Deceleration = 500f; [Export] public float RotationSpeed = 5f; [Export] public int Reach = 5; [Export] public double Health = 100; [Export] public double MaxHealth = 100; [Export] public double ActionPoints = 20; [Export] public double MaxActionPoints = 20; [Export] public int AmmoAmount = 30; [Export] public int MaxAmmoAmount = 30; [Export] public Camera2D PlayerCamera; [Export] public PlayerInput PlayerInput; [Export] public float PlayerDashAcceleration = 2f; [Export] public PackedScene BulletScene; [Export] public PackedScene TileScene; [Export] public float TileSize; [Export] public string PlayerName; [Export] public int PlayerId { get => _currentPlayerId; set { _currentPlayerId = value; PlayerInput.SetMultiplayerAuthority(value); } } [Signal] public delegate void PlayerDiedEventHandler(int killerId); public bool IsCurrentPlayer => _currentPlayerId == Multiplayer.GetUniqueId(); public bool IsReloading => !GetNode("ReloadTimer").IsStopped(); public double TimeRemainingOfReload => GetNode("ReloadTimer").TimeLeft; public override void _Ready() { Health = MaxHealth; ActionPoints = MaxActionPoints; if (PlayerId == Multiplayer.GetUniqueId()) PlayerCamera.Enabled = true; PlayerName ??= $"Player#{PlayerId}"; GetNode