Remove handing of Singular Update pckts from Client
This commit is contained in:
parent
0fcaa19506
commit
c1d620bc9c
@ -68,22 +68,19 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
|||||||
Player obj = Net.SpawnPlayer(spawn.Location).GetComponent<Player>();
|
Player obj = Net.SpawnPlayer(spawn.Location).GetComponent<Player>();
|
||||||
NetPlayer player = new NetPlayer(spawn.PlayerId, obj);
|
NetPlayer player = new NetPlayer(spawn.PlayerId, obj);
|
||||||
Players.Add(spawn.PlayerId, player);
|
Players.Add(spawn.PlayerId, player);
|
||||||
} else if (packet is PlayerUpdatePckt) {
|
|
||||||
PlayerUpdatePckt updatePckt = (PlayerUpdatePckt)packet;
|
|
||||||
HandleUpdatePlayer(updatePckt);
|
|
||||||
} else if (packet is MultiplePlayerUpdatesPckt) {
|
} else if (packet is MultiplePlayerUpdatesPckt) {
|
||||||
MultiplePlayerUpdatesPckt multiple = (MultiplePlayerUpdatesPckt)packet;
|
MultiplePlayerUpdatesPckt multiple = (MultiplePlayerUpdatesPckt)packet;
|
||||||
foreach (PlayerUpdatePckt pckt in multiple.Updates) {
|
foreach (PlayerUpdatePckt pckt in multiple.Updates) {
|
||||||
HandleUpdatePlayer(pckt);
|
HandleUpdatePlayer(pckt);
|
||||||
}
|
}
|
||||||
|
} else if (packet is MultipleSyncsPckt) {
|
||||||
|
MultipleSyncsPckt multiple = (MultipleSyncsPckt)packet;
|
||||||
|
foreach (PlayerSyncPacket pckt in multiple.Syncs) {
|
||||||
|
HandleSyncPckt(pckt);
|
||||||
|
}
|
||||||
} else if (packet is PlayerJumpPckt) {
|
} else if (packet is PlayerJumpPckt) {
|
||||||
PlayerJumpPckt jump = (PlayerJumpPckt)packet;
|
PlayerJumpPckt jump = (PlayerJumpPckt)packet;
|
||||||
Players[jump.PlayerId].Controlled.Jump();
|
Players[jump.PlayerId].Controlled.Jump();
|
||||||
} else if (packet is PlayerSyncPacket) {
|
|
||||||
PlayerSyncPacket syncPckt = (PlayerSyncPacket)packet;
|
|
||||||
if (syncPckt.Unsynced || syncPckt.PlayerId != LocalPlayer.Id) {
|
|
||||||
Players[syncPckt.PlayerId].Controlled.ProcessSyncPacket(syncPckt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +91,12 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
|||||||
Players[pckt.PlayerId].Controlled.ProcessUpdatePacket(pckt);
|
Players[pckt.PlayerId].Controlled.ProcessUpdatePacket(pckt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleSyncPckt(PlayerSyncPacket syncPckt) {
|
||||||
|
if (syncPckt.Unsynced || syncPckt.PlayerId != LocalPlayer.Id) {
|
||||||
|
Players[syncPckt.PlayerId].Controlled.ProcessSyncPacket(syncPckt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void UpdateLocalPlayer() {
|
public override void UpdateLocalPlayer() {
|
||||||
if (SelfIdentified && Server != null) {
|
if (SelfIdentified && Server != null) {
|
||||||
PlayerUpdatePckt pckt = LocalPlayer.Controlled.CreateUpdatePacket();
|
PlayerUpdatePckt pckt = LocalPlayer.Controlled.CreateUpdatePacket();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using NeonTea.Quakeball.Networking.Packets;
|
using NeonTea.Quakeball.Networking.Packets;
|
||||||
|
using NeonTea.Quakeball.Interface;
|
||||||
|
|
||||||
namespace NeonTea.Quakeball.Players {
|
namespace NeonTea.Quakeball.Players {
|
||||||
/// <summary>The central glue class for players (both local and remote).</summary>
|
/// <summary>The central glue class for players (both local and remote).</summary>
|
||||||
@ -90,6 +91,7 @@ namespace NeonTea.Quakeball.Players {
|
|||||||
transform.position = syncPckt.Location;
|
transform.position = syncPckt.Location;
|
||||||
GroundVelocity = syncPckt.GroundVelocity;
|
GroundVelocity = syncPckt.GroundVelocity;
|
||||||
}
|
}
|
||||||
|
Terminal.Singleton.Println($"Processing sync: {syncPckt.Unsynced}");
|
||||||
return ShouldApply;
|
return ShouldApply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user