예제 #1
0
 /// <summary>
 /// Creates a payload from event args.
 /// </summary>
 /// <param name="e">Event args to construct from.</param>
 /// <returns>Constructed event payload.</returns>
 public static ProbePlayerEventPayload FromEventArgs(PlayerAsyncEventArgs e)
 => new ProbePlayerEventPayload
 {
     Id         = e.Player.Id,
     Name       = e.Player.Name,
     IsDead     = e.Player.IsDead,
     IsImpostor = e.Player.IsImpostor
 };
예제 #2
0
        private async Task Game_PlayerLeft(AmongUsGame sender, PlayerAsyncEventArgs e)
        {
            this.GameManager.RemovePlayer(e.Player.Name);

            var chn = this.GameManager.TextChannel;

            if (chn == 0ul)
            {
                return;
            }

            await this.DiscordBot.SendMessageAsync(chn, "Game ended");
        }
예제 #3
0
        private async Task Game_PlayerJoined(AmongUsGame sender, PlayerAsyncEventArgs e)
        {
            this.GameManager.AddPlayer(e.Player.Name);

            var chn = this.GameManager.TextChannel;

            if (chn == 0ul)
            {
                return;
            }

            await this.DiscordBot.SendMessageAsync(chn, $"New player: {e.Player.Name}");
        }
 private async Task Game_PlayerDied(AmongUsGame sender, PlayerAsyncEventArgs e)
 => await this.Comms.SendEventAsync(new ProbeEvent(ProbeEventType.PlayerDeath, ProbePlayerEventPayload.FromEventArgs(e)));
예제 #5
0
 private Task Game_PlayerDied(AmongUsGame sender, PlayerAsyncEventArgs e)
 {
     this.GameManager.MarkDead(e.Player.Name);
     return(Task.CompletedTask);
 }