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

24 lines
577 B
C#
Raw Normal View History

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