using System; using Godot; public class Player : KinematicBody2D, IInitializable { private static readonly TimeSpan TIME_BEFORE_REGEN = TimeSpan.FromSeconds(1.0); private static readonly TimeSpan REGEN_TIMER = TimeSpan.FromSeconds(1.0 / 3); private static readonly float REGEN_AMOUNT = 0.025F; private static readonly TimeSpan RESPAWN_TIMER = TimeSpan.FromSeconds(5); [Export] public NodePath DisplayNamePath { get; set; } [Export] public NodePath SpritePath { get; set; } public Label DisplayNameLabel { get; private set; } public Sprite Sprite { get; private set; } public IItems Items { get; private set; } public int NetworkID { get => int.Parse(Name); set => Name = value.ToString(); } public bool IsLocal => NetworkID == GetTree().GetNetworkUniqueId(); public string DisplayName { get => DisplayNameLabel.Text; set => DisplayNameLabel.Text = value; } public Color Color { get => Sprite.SelfModulate; set => Sprite.SelfModulate = value; } public Vector2 Velocity { get; set; } public float Health { get; set; } = 1.0F; public bool IsAlive => Health > 0.0F; private float _previousHealth; private float _regenDelay; private float _respawnDelay; public PlayerVisibilityTracker VisibilityTracker { get; } = new PlayerVisibilityTracker(); public void Initialize() { DisplayNameLabel = GetNode