Example #1
0
 public void Setup(Map m, PathFinder pathing)
 {
     pFinder = pathing;
     map = m;
 }
Example #2
0
        /// <summary>
        /// Called at the start of the game.
        /// </summary>
        /// <param name="map">The game map.</param>
        /// <param name="me">You. This is also in the players list.</param>
        /// <param name="players">All players (including you).</param>
        /// <param name="companies">The companies on the map.</param>
        /// <param name="passengers">The passengers that need a lift.</param>
        /// <param name="ordersEvent">Method to call to send orders to the server.</param>
        public void Setup(Map map, Player me, List<Player> players, List<Company> companies, List<Passenger> passengers,
            PlayerAIBase.PlayerOrdersEvent ordersEvent)
        {
            try
            {
                pFinder = new PathFinder();
                GameMap = map;
                GameInfo = new GameStatusInfo();
                GameInfo.Setup(map, pFinder);
                Players = players;
                Me = me;
                Companies = companies;
                Passengers = passengers;
                sendOrders = ordersEvent;

                List<Passenger> pickup = AllPickups(me, passengers);
                pFinder.computeAllPaths(map);
                pFinder.generateAdjacencyMatrix();

                // get the path from where we are to the dest.
                List<Point> path = CalculatePathPlus1(me, pickup[0].Lobby.BusStop);
                sendOrders("ready", path, pickup);
            }
            catch (Exception ex)
            {
                log.Fatal(string.Format("Setup({0}, ...", me == null ? "{null}" : me.Name), ex);
            }
        }