mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
29 lines
645 B
C#
29 lines
645 B
C#
using AmongUs.GameOptions;
|
|
using BetterAmongUs.Helpers;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace BetterAmongUs.Data.Replay.Events;
|
|
|
|
[Serializable]
|
|
internal sealed class VanishReplayEvent : IReplayEvent<int>
|
|
{
|
|
public string Id => "player_vanish";
|
|
|
|
[JsonInclude]
|
|
public int EventData { get; set; }
|
|
|
|
public void Play()
|
|
{
|
|
var player = Utils.PlayerFromPlayerId(EventData);
|
|
if (player?.Data.RoleType is RoleTypes.Phantom)
|
|
{
|
|
player?.SetRoleInvisibility(true, true, true);
|
|
}
|
|
}
|
|
|
|
public void Record(PlayerControl player)
|
|
{
|
|
EventData = player.PlayerId;
|
|
}
|
|
}
|