quantum-space-buddies/QSB/RespawnSync/Messages/PlayerRespawnMessage.cs

24 lines
577 B
C#
Raw Normal View History

2022-01-27 05:00:12 +00:00
using QSB.ClientServerStateSync;
2021-12-23 06:09:00 +00:00
using QSB.Messaging;
using QSB.Player;
2021-12-23 21:57:33 +00:00
namespace QSB.RespawnSync.Messages
2021-12-23 06:09:00 +00:00
{
2022-01-27 05:00:12 +00:00
internal class PlayerRespawnMessage : QSBMessage<uint>
2021-12-23 06:09:00 +00:00
{
2022-01-27 05:00:12 +00:00
public PlayerRespawnMessage(uint playerId) => Value = playerId;
2021-12-23 06:09:00 +00:00
public override void OnReceiveLocal() => OnReceiveRemote();
public override void OnReceiveRemote()
{
2022-01-27 05:00:12 +00:00
if (Value == QSBPlayerManager.LocalPlayerId)
2021-12-23 06:09:00 +00:00
{
RespawnManager.Instance.Respawn();
ClientStateManager.Instance.OnRespawn();
}
2022-01-27 05:00:12 +00:00
RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Value));
2021-12-23 06:09:00 +00:00
}
}
}