상속: AStarCollisionMap.Collision.CollisionMap
예제 #1
0
파일: Node.cs 프로젝트: Wotuu/RTS_XNA_v2
 /// <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.</param>
 public Node(RTSCollisionMap map, int x, int y, Boolean forceNodeCreation)
     : base(map)
 {
     Init(x, y);
     if (forceNodeCreation) this.CreateConnections(PathfindingNode.MAX_CONNECT_RANGE);
     else SmartPathfindingNodeProcessor.GetInstance().Push(this);
 }
예제 #2
0
 public BuildingMesh(RTSCollisionMap collision)
 {
     this.collision = collision;
     createdNodes = new Node[4];
     removedNodes = new CustomArrayList<Point>();
 }
예제 #3
0
파일: Node.cs 프로젝트: Cur10s1ty/RTS_XNA
 public Node(RTSCollisionMap map, int x, int y)
     : base(map)
 {
     Init(x, y);
     PathfindingNodeProcessor.GetInstance().Push(this);
 }
예제 #4
0
파일: Node.cs 프로젝트: Cur10s1ty/RTS_XNA
 /// <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(RTSCollisionMap map, int x, int y, Boolean forceNodeCreation)
     : base(map)
 {
     Init(x, y);
     this.CreateConnections();
 }
예제 #5
0
파일: Game1.cs 프로젝트: Cur10s1ty/RTS_XNA
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            drawLineTexture = this.Content.Load<Texture2D>("Misc/solid");
            font = Content.Load<SpriteFont>("Fonts/Arial");
            (collision = new RTSCollisionMap(this, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight)).PlaceNodesAroundEdges();
            graphics.PreferMultiSampling = true;

            (quadTree = new QuadRoot(new Rectangle(0, 0,
                graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight)
                )).CreateTree(5);

            players = new LinkedList<Player>();

            Alliance redAlliance = new Alliance();
            Player humanPlayer = new Player(redAlliance, Color.Red);
            players.AddLast((CURRENT_PLAYER = humanPlayer));
            humanPlayer.SpawnStartUnits(new Point((int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2,
                (int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2));

            Alliance greenAlliance = new Alliance();
            Player aiPlayer = new Player(greenAlliance, Color.Green);
            players.AddLast(aiPlayer);
            aiPlayer.SpawnStartUnits(new Point((int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2, 200));

            //SaveManager.GetInstance().SaveNodes("C:\\Users\\Wouter\\Desktop\\test.xml");
            MouseManager.GetInstance().mouseClickedListeners += ((MouseClickListener)this).OnMouseClick;
            MouseManager.GetInstance().mouseReleasedListeners += ((MouseClickListener)this).OnMouseRelease;
            MouseManager.GetInstance().mouseMotionListeners += ((MouseMotionListener)this).OnMouseMotion;
            MouseManager.GetInstance().mouseDragListeners += ((MouseMotionListener)this).OnMouseDrag;

            /*XNAPanel panel = new XNAPanel(null, new Rectangle(
                this.graphics.PreferredBackBufferWidth / 2 - 200,
                this.graphics.PreferredBackBufferHeight / 2 - 200,
                400, 400));
            XNAButton button = new XNAButton(panel, new Rectangle(10, 10, 100, 40), "");*/

            base.Initialize();
        }