示例#1
0
        private IEnumerable <DispatchItem> GetDispatchDestinations()
        {
            List <DispatchItem> destinations = new List <DispatchItem>();

            if (player.ActionCounter.Count == 0)
            {
                return(destinations);
            }

            foreach (Player player in players)
            {
                DriveManager dm = new DriveManager(player);
                foreach (DriveDestinationItem ddi in dm.GetDestinations(this.player.ActionCounter.Count))
                {
                    if (ddi.Node.Players.Count() == 0)
                    {
                        destinations.Add(new DispatchItem(player, ddi.Node, ddi.Cost));
                    }
                }

                foreach (Player sub in players)
                {
                    if (sub.Location != player.Location && destinations.Where(i => i.Player == player && i.DispatchDestination == sub.Location).Count() == 0)
                    {
                        destinations.Add(new DispatchItem(player, sub.Location, 1));
                    }
                }
            }

            return(destinations);
        }
        private IEnumerable<DispatchItem> GetDispatchDestinations()
        {
            List<DispatchItem> destinations = new List<DispatchItem>();

            if (player.ActionCounter.Count == 0)
                return destinations;

            foreach (Player player in players)
            {

                DriveManager dm = new DriveManager(player);
                foreach (DriveDestinationItem ddi in dm.GetDestinations(this.player.ActionCounter.Count))
                {
                    if (ddi.Node.Players.Count() == 0)
                        destinations.Add(new DispatchItem(player, ddi.Node, ddi.Cost));
                }

                foreach (Player sub in players)
                {
                    if (sub.Location != player.Location && destinations.Where(i => i.Player == player && i.DispatchDestination == sub.Location).Count() == 0)
                        destinations.Add(new DispatchItem(player, sub.Location, 1));
                }
            }

            return destinations;
        }