protected void TryCreateDuel(Player player, Player opponent) { player.StopWaitingPartner(); player.PartnerWaitTimerElapsed -= OnWaitPartnerTimerElapsed; opponent.StopWaitingPartner(); opponent.PartnerWaitTimerElapsed -= OnWaitPartnerTimerElapsed; var duel = new Duel(Random, new List <Player> { player, opponent }); DuelService.Add(duel); PrepareDuel(duel); }
public Duel CreateDuel(string connectionId) { var player = PlayerService.Get(connectionId); if (player == null) { return(null); } var duel = new Duel(Random, new List <Player> { player }); DuelService.Add(duel); return(duel); }