/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Game1 game = new Game1()) { game.Run(); } }
public void getFieldTest() { int width = 2; int height = 2; Game1 Game = new Game1(); WorldMap target = new WorldMap(width, height, Game); // TODO: Initialize to an appropriate value iField actual; // Element istniejacy actual = target.getField(0,0); Assert.AreEqual(0, actual.X); Assert.AreEqual(0, actual.Y); // Element 'poza mapa' - gorna granica actual = target.getField(width+2,height+2); Assert.AreEqual(width-1, actual.X); Assert.AreEqual(height-1, actual.Y); // Element 'poza mapa' - dolna granica actual = target.getField(-1, -1); Assert.AreEqual(0, actual.X); Assert.AreEqual(0, actual.Y); }
public WorldMap(int width, int height, Game1 Game) { this.width = width; this.height = height; this.Game = Game; this.fieldList = new World.Map.Field.iField[this.width, this.height]; for (int w = 0; w < this.width; w++) { for (int h = 0; h < this.height; h++) { Vector2 pos = new Vector2(0, 0); pos.Y = w * (64 / 2) - (w * 7); pos.X = -w * (100 / 2); // -(w); pos.Y += h * ((100 / 2) / 2); pos.X += h * (100 / 2); /* if (h % 5 == 1 && w % 5 == 1) { this.fieldList[w, h] = new World.Map.Field.Grass(this.Game); this.fieldList[w, h].Level = 1; } else if (h % 5 == 2 && w % 5 == 1) { this.fieldList[w, h] = new World.Map.Field.Hill.HillSE(this.Game); } else if (h % 5 == 1 && w % 5 == 2) { //this.fieldList[w, h] = new World.Map.Field.Hill.HillSW(this.Game); this.fieldList[w, h] = new World.Map.Field.Grass(this.Game); } else if (h % 5 == 0 && w % 5 == 2) { this.fieldList[w, h] = new World.Map.Field.Hill.HillW(this.Game); } else if (h % 5 == 2 && w % 5 == 2) { this.fieldList[w, h] = new World.Map.Field.Hill.HillS(this.Game); } else if (h % 5 == 0 && w % 5 == 0) { this.fieldList[w, h] = new World.Map.Field.Hill.HillN(this.Game); } else if (h % 5 == 0 && w % 5 == 1) { this.fieldList[w, h] = new World.Map.Field.Hill.HillNW(this.Game); } else if (h % 5 == 1 && w % 5 == 0) { this.fieldList[w, h] = new World.Map.Field.Hill.HillNE(this.Game); } else if (h % 5 == 2 && w % 5 == 0) { this.fieldList[w, h] = new World.Map.Field.Hill.HillE(this.Game); } else { this.fieldList[w, h] = new World.Map.Field.Grass(this.Game); } * */ this.fieldList[w, h] = new World.Map.Field.Grass(this.Game); this.fieldList[w, h].mPosition = pos; this.fieldList[w, h].X = w; this.fieldList[w, h].Y = h; } } this.mapZero = this.fieldList[0,0].mPosition; for (int w = 0; w < this.width; w++) { for (int h = 0; h < this.height; h++) { this.fieldList[w, h].bindAdjacentField(this); } } this.initKubelki(); }