Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit f1a160d

Browse files
do not broadcast delta anymore
1 parent 9da7100 commit f1a160d

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

Scripts/Scenes/Game/ClientPlayer.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Timer = System.Timers.Timer;
22

3+
using ENet;
34
using Godot;
45
using GodotModules.Netcode;
56
using 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

Comments
 (0)