示例#1
0
        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);
        }
示例#2
0
        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);
        }