11using Timer = System . Timers . Timer ;
22
3+ using ENet ;
34using Godot ;
45using GodotModules . Netcode ;
56using GodotModules . Netcode . Client ;
@@ -10,25 +11,29 @@ namespace Game
1011{
1112 public class ClientPlayer : OtherPlayer
1213 {
14+ [ Export ] public readonly NodePath NodePathLabelPosition ;
15+ private Label LabelPosition { get ; set ; }
16+
1317 private float Speed = 250f ;
1418 private Timer TimerNotifyServerProcessDelta { get ; set ; }
1519 private float Delta { get ; set ; }
1620
17- public override async void _Ready ( )
21+ public override void _Ready ( )
1822 {
1923 base . _Ready ( ) ;
2024 SetHealth ( 100 ) ;
25+ LabelPosition = GetNode < Label > ( NodePathLabelPosition ) ;
2126
2227 if ( GameClient . Running )
2328 {
24- await NotifyServerOfProcessDelta ( ) ;
29+ // await NotifyServerOfProcessDelta();
2530
2631 if ( GameClient . IsHost )
2732 {
28- TimerNotifyServerProcessDelta = new Timer ( 3000 ) ;
33+ /* TimerNotifyServerProcessDelta = new Timer(3000);
2934 TimerNotifyServerProcessDelta.Elapsed += TimerNotifyServerProcessDeltaCallback;
3035 TimerNotifyServerProcessDelta.AutoReset = true;
31- TimerNotifyServerProcessDelta . Enabled = true ;
36+ TimerNotifyServerProcessDelta.Enabled = true;*/
3237 }
3338 }
3439 }
@@ -45,6 +50,7 @@ private async Task NotifyServerOfProcessDelta() =>
4550 public override void _Process ( float delta )
4651 {
4752 Delta = delta ;
53+ LabelPosition . Text = $ "X: { Mathf . RoundToInt ( Position . x ) } Y: { Mathf . RoundToInt ( Position . y ) } ";
4854 HandleMovement ( delta ) ;
4955 }
5056
0 commit comments