Esempio n. 1
0
 /// <summary>
 /// Creates a node that doesn't make it's connections in the constructor.
 /// </summary>
 /// <param name="x">The X</param>
 /// <param name="y">The Y</param>
 /// <param name="forceNodeCreation">Instantly creates connections. This param does nothing.</param>
 public Node(CollisionMap map, int x, int y, Boolean forceNodeCreation,GraphicsDevice adapter)
     : base(map)
 {
     this.graphicsDevice = adapter;
     Init(x, y);
     this.CreateConnections();
 }
Esempio n. 2
0
 public CollisionChangedEvent(CollisionMap c, Boolean[] oldData, Boolean[] newData, Rectangle changedRect, Boolean collisionAdded)
 {
     this.collision = c;
     this.oldData = oldData;
     this.newData = newData;
     this.changedRect = changedRect;
     this.collisionAdded = collisionAdded;
 }
Esempio n. 3
0
 public Node(CollisionMap map, int x, int y,GraphicsDevice adapter)
     : base(map)
 {
     this.graphicsDevice = adapter;
     viewport = new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height);
     Init(x, y);
     PathfindingNodeProcessor.GetInstance().Push(this);
 }
Esempio n. 4
0
 /// <summary>
 /// Called when a map tile of the collisionmap is loaded!
 /// </summary>
 /// <param name="source">The collisionmap that triggered this event.</param>
 private void OnMapTileLoaded(CollisionMap source)
 {
     Game1.GetInstance().currentLoadProgress += 400;
 }
Esempio n. 5
0
 public PathfindingNode(CollisionMap collisionMap)
 {
     this.collisionMap = collisionMap;
     connections = new LinkedList<PathfindingNodeConnection>();
     collisionMap.collisionChangedListeners += ((OnCollisionChangedListener)this).OnCollisionChanged;
 }
Esempio n. 6
0
 public CollisionChangedEvent(CollisionMap collisionMap, Rectangle changedRect, Boolean collisionAdded)
 {
     this.collisionMap = collisionMap;
     this.changedRect = changedRect;
     this.collisionAdded = collisionAdded;
 }
Esempio n. 7
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openfile = new OpenFileDialog();
            //savefile.InitialDirectory = "../Tilesets";
            openfile.Filter = "XML Document (*.xml)|*.xml";
            openfile.Title = "Save map";

            if (openfile.ShowDialog() == DialogResult.OK)
            {
                Players.Clear();
                tileMap = new TileMap.TileMap(1, 1);

               tileMap = tileMap.opentilemap(openfile.FileName);

                //load Collisionmap
               PathfindingNodeManager.GetInstance().ClearNodes();
               CollisionMap = new CollisionMap(GraphicsDevice, tileMap.MapWidth * Engine.TileWidth, tileMap.MapHeight * Engine.TileHeight, true, Util.GetQuadDepth(tileMap.MapWidth));
               CollisionMap.LoadMap(openfile.FileName.Substring(0, openfile.FileName.LastIndexOf('\\')), openfile.FileName.Substring(openfile.FileName.LastIndexOf('\\')).Replace(".xml", ""));
               PathfindingNodeManager.GetInstance().ClearNodes();
                Util.LoadNodes(openfile.FileName, GraphicsDevice);
                Util.LoadPlayers(openfile.FileName);
                CollisionData = new int[(tileMap.MapWidth * Engine.TileWidth) * (tileMap.MapHeight * Engine.TileHeight)];
               currentLayer = tileMap.layers[0];
            }
        }
Esempio n. 8
0
        private void createNewMap()
        {
            //get values from newmapform

            tileMap = new TileMap.TileMap(mapform.MapWidth, mapform.MapHeight);
            CollisionMap = new CollisionMap(GraphicsDevice, mapform.MapWidth * Engine.TileWidth, mapform.MapHeight * Engine.TileHeight,true,Util.GetQuadDepth(mapform.MapWidth));
            //CollisionData  = new int[(mapform.MapWidth * Engine.TileWidth) * (mapform.MapHeight * Engine.TileHeight)];
            currentLayer = tileMap.layers[0];
            Players.Clear();
            PathfindingNodeManager.GetInstance().ClearNodes();
        }