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

24 lines
574 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;
namespace QSB.RespawnSync.Messages
2021-12-23 06:09:00 +00:00
{
internal class PlayerRespawnMessage : QSBMessage<uint>
{
public PlayerRespawnMessage(uint playerId) => Data = playerId;
2021-12-23 06:09:00 +00:00
public override void OnReceiveLocal() => OnReceiveRemote();
2021-12-23 06:09:00 +00:00
public override void OnReceiveRemote()
2021-12-23 06:09:00 +00:00
{
if (Data == QSBPlayerManager.LocalPlayerId)
{
RespawnManager.Instance.Respawn();
ClientStateManager.Instance.OnRespawn();
}
RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Data));
}
2021-12-23 06:09:00 +00:00
}
}