示例#1
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch               = new ExtendedSpriteBatch(GraphicsDevice);
            RadarUnit.UnitTexture     = Content.Load <Texture2D>("arrow_without_border");
            RadarPlayer.PlayerTexture = Content.Load <Texture2D>("arrow");
            RadarSpell.SpellTexture   = Content.Load <Texture2D>("donut");
            myMap = WoWMap.Arena_BE(this);

            // TODO: use this.Content to load your game content here
        }
示例#2
0
        public Pather(string continent, ConnectionHandlerDelegate connectionHandler)
        {
            lock (_threadLocker)
            {
                try
                {
                    ConnectionHandler = connectionHandler;

                    Continent = continent.Substring(continent.LastIndexOf('\\') + 1);

                    string dir = Application.StartupPath;
                    _meshPath = dir + "\\Meshes"; // + continent;


                    if (!Directory.Exists(_meshPath))
                    {
                        Logging.WriteNavigator(DetourStatus.Failure + " No mesh for " + continent + " (Path: " + _meshPath +
                                               ")");
                    }

                    _mesh        = new NavMesh();
                    _loadedTiles = new Dictionary <Tuple <int, int>, int>();
                    _failedTiles = new Dictionary <Tuple <int, int>, int>();
                    if (_loadTileCheck == null)
                    {
                        _loadTileCheck = new Helpful.Timer(60 * 1000); // 1 min
                    }
                    DetourStatus status;

                    // check if this is a dungeon and initialize our mesh accordingly
                    WoWMap map = WoWMap.FromMPQName(continent);
                    if (map.Record.MapType == WoWMap.MapType.WDTOnlyType || continent == "AllianceGunship")
                    {
                        string dungeonPath = GetDungeonPath();
                        if (!File.Exists(_meshPath + "\\" + dungeonPath))
                        {
                            downloadTile(dungeonPath);
                        }
                        byte[] data = File.ReadAllBytes(_meshPath + "\\" + dungeonPath);
                        status = _mesh.Initialize(data);
                        AddMemoryPressure(data.LongLength);
                        IsDungeon = true;
                    }
                    else //                       20bits 28bits
                    {
                        status = _mesh.Initialize(1048576, 2048 * Division * Division, Utility.Origin, Utility.TileSize / Division, Utility.TileSize / Division);
                    }
                    // maxPolys = 1 << polyBits (20) = 1048576
                    // maxTiles = is 8192 (was 4096), Travel loads tons of tile in quester.
                    // I have logs with over 6000 .tile files loaded.

                    if (status.HasFailed())
                    {
                        Logging.WriteNavigator(status + " Failed to initialize the mesh");
                    }

                    _query = new NavMeshQuery(new PatherCallback(this));
                    DetourStatus t = _query.Initialize(_mesh, 524287); // 20bits - 1
                    //Logging.WriteDebug("NavMeshQuery initialized with status: " + t);
                    Filter = new QueryFilter {
                        IncludeFlags = 0xFFFF, ExcludeFlags = 0x0
                    };
                    // Add the costs
                    Filter.SetAreaCost((int)PolyArea.Water, 4);
                    Filter.SetAreaCost((int)PolyArea.Terrain, 1);
                    Filter.SetAreaCost((int)PolyArea.Road, 1);  // This is the Taxi system, not in tiles yet
                    Filter.SetAreaCost((int)PolyArea.Danger, 25);
                    if (nManagerSetting.DangerousZones.Count > 0)
                    {
                        int addedDangers = ReportDanger(nManagerSetting.DangerousZones, true);
                        if (addedDangers > 0)
                        {
                            Logging.WriteNavigator(addedDangers + " dangers added.");
                        }
                    }
                }
                catch (Exception exception)
                {
                    Logging.WriteError("Pather(string continent, ConnectionHandlerDelegate connectionHandler): " + exception);
                }
            }
        }