- Timestamp:
- 2012-07-05 10:56:50 (11 years ago)
- Location:
- 2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/Room.cs
r3568 r3570 84 84 { 85 85 if (roomDecorations.Count == 0) throw new Exception("Cannot destory empty room!"); 86 if (!isBuilt) throw new Exception("Cannot destroy unbuilt room!");86 if (!isBuilt) return; 87 87 88 88 foreach (IPhysicsObject obj in roomDecorations) -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/TheDungeonGame.cs
r3568 r3570 23 23 public LevelGenerator LevelGen { get { return generator; } } 24 24 25 private Vector cameraPosMission, cameraVelocity, newPos, currentPos; 25 private Vector cameraPosMission, cameraVelocity, newPos, oldPos; 26 private Room oldRoom; 26 27 private bool moveCamera = false; 27 28 … … 40 41 Level.Height = ROOMHEIGHT * 20; 41 42 setupLevelTextures(1); 42 setupObjectTextures(); 43 44 43 setupObjectTextures(); 45 44 46 45 generator = new LevelGenerator(this, Level.Size, new Vector(20, 20)); 47 46 generator.generateRandomLevel(5, 10); 48 47 generator.initDungeon(); 49 generator.buildDungeon();48 // generator.buildDungeon(); 50 49 Room centerRoom = generator.getRoomAt((int)(generator.CenterRoom.X), (int)(generator.CenterRoom.Y)); 51 50 Camera.Position = centerRoom.Position + new Vector(ROOMWIDTH / 2 + ROOMTHICKNESS / 2, -ROOMHEIGHT / 2 + ROOMTHICKNESS / 4); 52 51 //Camera.ZoomToLevel(); 52 //Camera.Zoom(0.5); 53 53 54 54 player = new Player(this, Vector.Zero, playerPic); … … 98 98 public void moveToRoom(Room room, int dir) 99 99 { 100 currentPos = player.currentRoom.Position + new Vector(ROOMWIDTH / 2 + ROOMTHICKNESS / 2, -ROOMHEIGHT / 2 + ROOMTHICKNESS / 4);100 oldPos = player.currentRoom.Position + new Vector(ROOMWIDTH / 2 + ROOMTHICKNESS / 2, -ROOMHEIGHT / 2 + ROOMTHICKNESS / 4); 101 101 newPos = room.Position + new Vector(ROOMWIDTH / 2 + ROOMTHICKNESS / 2, -ROOMHEIGHT / 2 + ROOMTHICKNESS / 4); 102 moveCameraTo(newPos - currentPos); 102 oldRoom = player.currentRoom; 103 room.buildLevel(); 104 moveCameraTo(newPos - oldPos); 103 105 player.Position = player.currentRoom.getDoor(dir).Position + RoomDirection.getOffsetFromWorldDir(dir) * 130; 104 106 } … … 122 124 Camera.Position = newPos; 123 125 moveCamera = false; 126 oldRoom.destroyLevel(); 124 127 } 125 128 } … … 129 132 player.Position = generator.getRoomAt(generator.CenterRoom).Position + new Vector(ROOMWIDTH / 2, -ROOMHEIGHT / 2); 130 133 player.currentRoom = generator.getRoomAt(generator.CenterRoom); 134 player.currentRoom.buildLevel(); 131 135 Add(player, 2); 132 136 } … … 138 142 generator.generateRandomLevel(10, 15); 139 143 generator.initDungeon(); 140 generator.buildDungeon();144 // generator.buildDungeon(); 141 145 player.currentRoom = generator.getRoomAt(generator.CenterRoom); 146 player.currentRoom.buildLevel(); 142 147 } 143 148
Note: See TracChangeset
for help on using the changeset viewer.