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

Commit 34acb43

Browse files
Send delta right away if host
1 parent d024a30 commit 34acb43

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Scripts/Scenes/Game/ClientPlayer.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ public class ClientPlayer : OtherPlayer
1414
private Timer TimerNotifyServerProcessDelta { get; set; }
1515
private float Delta { get; set; }
1616

17-
public override void _Ready()
17+
public override async void _Ready()
1818
{
1919
base._Ready();
2020
SetHealth(100);
2121

2222
if (GameClient.Running)
2323
{
24+
await NotifyServerOfProcessDelta();
25+
2426
if (GameClient.IsHost)
2527
{
2628
TimerNotifyServerProcessDelta = new Timer(3000);
@@ -31,13 +33,14 @@ public override void _Ready()
3133
}
3234
}
3335

34-
public async void TimerNotifyServerProcessDeltaCallback(System.Object source, ElapsedEventArgs args)
35-
{
36+
public async void TimerNotifyServerProcessDeltaCallback(System.Object source, ElapsedEventArgs args) =>
37+
await NotifyServerOfProcessDelta();
38+
39+
private async Task NotifyServerOfProcessDelta() =>
3640
await GameClient.Send(ClientPacketOpcode.ProcessDelta, new CPacketProcessDelta
3741
{
3842
Delta = Delta
3943
});
40-
}
4144

4245
public override void _Process(float delta)
4346
{

0 commit comments

Comments
 (0)