Пример #1
0
		public DefenderMap() {
			mCrossroads = new CrossroadList();
			mWidth = mHeight = 0;
			mLargestIndex = 0;
			mCollisionLayer = new ECollisionType[ mWidth, mHeight ];
			mTowerLayer = new bool[ mWidth, mHeight ];
		}
Пример #2
0
		public DefenderMap( Texture2D Texture ) {
			mCrossroads = new CrossroadList();

			mCollisionTex = Texture;
			mWidth = mCollisionTex.Width;
			mHeight = mCollisionTex.Height;
			mCollisionLayer = new ECollisionType[ mWidth, mHeight ];
			mTowerLayer = new bool[ mWidth, mHeight ];

			mLargestIndex = ( Width - 1 ) + ( ( Height - 1 ) * Width );

			BuildCollisionLayer();
		}
Пример #3
0
        private void SetupMap(Texture2D texColorKey)
        {
            mMap = new DefenderMap(texColorKey);
            #region TowerDefence Final Version Map
            Crossroad x1  = new Crossroad(0, 0);
            Crossroad x2  = new Crossroad(200, 200);
            Crossroad x3  = new Crossroad(520, 280);
            Crossroad x4  = new Crossroad(540, 80);
            Crossroad x5  = new Crossroad(960, 40);
            Crossroad x6  = new Crossroad(1000, 200);
            Crossroad x7  = new Crossroad(900, 300);
            Crossroad x8  = new Crossroad(860, 520);
            Crossroad x9  = new Crossroad(1200, 620);
            Crossroad x10 = new Crossroad(1400, 500);
            Crossroad x11 = new Crossroad(1720, 320);
            Crossroad x12 = new Crossroad(1880, 380);
            Crossroad x13 = new Crossroad(1940, 520);
            Crossroad x14 = new Crossroad(1780, 600);
            Crossroad x15 = new Crossroad(1580, 780);
            Crossroad x16 = new Crossroad(1800, 880);
            Crossroad x17 = new Crossroad(1880, 1160);
            Crossroad x18 = new Crossroad(1600, 1200);
            Crossroad x19 = new Crossroad(1740, 1420);
            Crossroad x20 = new Crossroad(1460, 1560);
            Crossroad x21 = new Crossroad(1180, 1560);
            Crossroad x22 = new Crossroad(1000, 1800);
            Crossroad x23 = new Crossroad(720, 1940);
            Crossroad x24 = new Crossroad(600, 1760);
            Crossroad x25 = new Crossroad(720, 1580);
            Crossroad x26 = new Crossroad(600, 1400);
            Crossroad x27 = new Crossroad(420, 1560);
            Crossroad x28 = new Crossroad(340, 1660);
            Crossroad x29 = new Crossroad(80, 1560);
            Crossroad x30 = new Crossroad(200, 1280);
            Crossroad x31 = new Crossroad(400, 1220);
            Crossroad x32 = new Crossroad(360, 840);
            Crossroad x33 = new Crossroad(60, 780);
            Crossroad x34 = new Crossroad(280, 460);
            Crossroad end = new Crossroad(1800, 1800);

            Crossroads = new CrossroadList(x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31, x32, x33, x34, end);
            Spawns     = new CrossroadList(x1);

            #region connections
            x1.Connections.Add(x2);
            x2.Connections.Add(x3);
            x2.Connections.Add(x34);
            x3.Connections.Add(x4);
            x4.Connections.Add(x5);
            x5.Connections.Add(x6);
            x6.Connections.Add(x7);
            x7.Connections.Add(x8);
            x8.Connections.Add(x9);
            x9.Connections.Add(x10);
            x10.Connections.Add(x11);
            x11.Connections.Add(x12);
            x12.Connections.Add(x13);
            x13.Connections.Add(x14);
            x14.Connections.Add(x15);
            x15.Connections.Add(x16);
            x16.Connections.Add(x17);
            x17.Connections.Add(x18);
            x18.Connections.Add(x19);
            x19.Connections.Add(x20);
            x20.Connections.Add(end);
            x34.Connections.Add(x33);
            x33.Connections.Add(x32);
            x32.Connections.Add(x31);
            x31.Connections.Add(x30);
            x30.Connections.Add(x29);
            x29.Connections.Add(x28);
            x28.Connections.Add(x27);
            x27.Connections.Add(x26);
            x26.Connections.Add(x25);
            x25.Connections.Add(x24);
            x24.Connections.Add(x23);
            x23.Connections.Add(x22);
            x22.Connections.Add(x21);
            x21.Connections.Add(x20);
            #endregion
            #endregion

            // Debug cross road structure
            //System.Xml.Serialization.XmlSerializer xml = new System.Xml.Serialization.XmlSerializer(typeof(CrossroadList));
            //xml.Serialize(System.IO.File.OpenWrite("crossroads.xml"), Crossroads);

            Paths = new Paths(Spawns.PathCount + Crossroads.PathCount);
            Paths.CalculatePaths(Crossroads);
            Paths.CalculatePaths(Spawns);

            MapBaseArea = new Rectangle(end.X - 30 + TileSize / 2, end.Y - 30 + TileSize / 2, 60, 60);
        }
Пример #4
0
		public Crossroad(Point pos, CrossroadList connections, int tier)
			: this(new Rectangle(pos.X, pos.Y, DefenderWorld.TileSize, DefenderWorld.TileSize), connections, tier) {
		}
Пример #5
0
		public Crossroad(Rectangle area, CrossroadList connections, int tier)
			: this() {
			mArea = area;
			mConnections.AddRange(connections);
			mTier = tier;
		}
Пример #6
0
		public Crossroad() {
			mArea = Rectangle.Empty;
			mConnections = new CrossroadList();
			mTier = 0;
		}
Пример #7
0
		private void SetupMap(Texture2D texColorKey) {
			mMap = new DefenderMap(texColorKey);
			#region TowerDefence Final Version Map
			Crossroad x1 = new Crossroad(0, 0);
			Crossroad x2 = new Crossroad(200, 200);
			Crossroad x3 = new Crossroad(520, 280);
			Crossroad x4 = new Crossroad(540, 80);
			Crossroad x5 = new Crossroad(960, 40);
			Crossroad x6 = new Crossroad(1000, 200);
			Crossroad x7 = new Crossroad(900, 300);
			Crossroad x8 = new Crossroad(860, 520);
			Crossroad x9 = new Crossroad(1200, 620);
			Crossroad x10 = new Crossroad(1400, 500);
			Crossroad x11 = new Crossroad(1720, 320);
			Crossroad x12 = new Crossroad(1880, 380);
			Crossroad x13 = new Crossroad(1940, 520);
			Crossroad x14 = new Crossroad(1780, 600);
			Crossroad x15 = new Crossroad(1580, 780);
			Crossroad x16 = new Crossroad(1800, 880);
			Crossroad x17 = new Crossroad(1880, 1160);
			Crossroad x18 = new Crossroad(1600, 1200);
			Crossroad x19 = new Crossroad(1740, 1420);
			Crossroad x20 = new Crossroad(1460, 1560);
			Crossroad x21 = new Crossroad(1180, 1560);
			Crossroad x22 = new Crossroad(1000, 1800);
			Crossroad x23 = new Crossroad(720, 1940);
			Crossroad x24 = new Crossroad(600, 1760);
			Crossroad x25 = new Crossroad(720, 1580);
			Crossroad x26 = new Crossroad(600, 1400);
			Crossroad x27 = new Crossroad(420, 1560);
			Crossroad x28 = new Crossroad(340, 1660);
			Crossroad x29 = new Crossroad(80, 1560);
			Crossroad x30 = new Crossroad(200, 1280);
			Crossroad x31 = new Crossroad(400, 1220);
			Crossroad x32 = new Crossroad(360, 840);
			Crossroad x33 = new Crossroad(60, 780);
			Crossroad x34 = new Crossroad(280, 460);
			Crossroad end = new Crossroad(1800, 1800);

			Crossroads = new CrossroadList(x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31, x32, x33, x34, end);
			Spawns = new CrossroadList(x1);

			#region connections
			x1.Connections.Add(x2);
			x2.Connections.Add(x3);
			x2.Connections.Add(x34);
			x3.Connections.Add(x4);
			x4.Connections.Add(x5);
			x5.Connections.Add(x6);
			x6.Connections.Add(x7);
			x7.Connections.Add(x8);
			x8.Connections.Add(x9);
			x9.Connections.Add(x10);
			x10.Connections.Add(x11);
			x11.Connections.Add(x12);
			x12.Connections.Add(x13);
			x13.Connections.Add(x14);
			x14.Connections.Add(x15);
			x15.Connections.Add(x16);
			x16.Connections.Add(x17);
			x17.Connections.Add(x18);
			x18.Connections.Add(x19);
			x19.Connections.Add(x20);
			x20.Connections.Add(end);
			x34.Connections.Add(x33);
			x33.Connections.Add(x32);
			x32.Connections.Add(x31);
			x31.Connections.Add(x30);
			x30.Connections.Add(x29);
			x29.Connections.Add(x28);
			x28.Connections.Add(x27);
			x27.Connections.Add(x26);
			x26.Connections.Add(x25);
			x25.Connections.Add(x24);
			x24.Connections.Add(x23);
			x23.Connections.Add(x22);
			x22.Connections.Add(x21);
			x21.Connections.Add(x20);
			#endregion
			#endregion

			// Debug cross road structure
			//System.Xml.Serialization.XmlSerializer xml = new System.Xml.Serialization.XmlSerializer(typeof(CrossroadList));
			//xml.Serialize(System.IO.File.OpenWrite("crossroads.xml"), Crossroads);

			Paths = new Paths(Spawns.PathCount + Crossroads.PathCount);
			Paths.CalculatePaths(Crossroads);
			Paths.CalculatePaths(Spawns);

			MapBaseArea = new Rectangle(end.X - 30 + TileSize / 2, end.Y - 30 + TileSize / 2, 60, 60);
		}