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

23 lines
557 B
C#
Raw Permalink 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;
2022-03-03 03:46:33 +00:00
namespace QSB.RespawnSync.Messages;
2023-07-28 18:30:57 +00:00
public class PlayerRespawnMessage : QSBMessage<uint>
2021-12-23 06:09:00 +00:00
{
2022-03-11 01:57:50 +00:00
public PlayerRespawnMessage(uint playerId) : base(playerId) { }
2021-12-23 06:09:00 +00:00
2022-03-03 03:46:33 +00:00
public override void OnReceiveLocal() => OnReceiveRemote();
2021-12-23 06:09:00 +00:00
2022-03-03 03:46:33 +00:00
public override void OnReceiveRemote()
{
if (Data == QSBPlayerManager.LocalPlayerId)
2021-12-23 06:09:00 +00:00
{
2022-03-03 03:46:33 +00:00
RespawnManager.Instance.Respawn();
ClientStateManager.Instance.OnRespawn();
}
2022-03-03 03:46:33 +00:00
RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Data));
2021-12-23 06:09:00 +00:00
}
}