Changeset 3570 for 2012


Ignore:
Timestamp:
2012-07-05 10:56:50 (7 years ago)
Author:
dezhidki
Message:

Talletus.

Location:
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/Room.cs

    r3568 r3570  
    8484        { 
    8585            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; 
    8787 
    8888            foreach (IPhysicsObject obj in roomDecorations) 
  • 2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/TheDungeonGame.cs

    r3568 r3570  
    2323    public LevelGenerator LevelGen { get { return generator; } } 
    2424 
    25     private Vector cameraPosMission, cameraVelocity, newPos, currentPos; 
     25    private Vector cameraPosMission, cameraVelocity, newPos, oldPos; 
     26    private Room oldRoom; 
    2627    private bool moveCamera = false; 
    2728 
     
    4041        Level.Height = ROOMHEIGHT * 20; 
    4142        setupLevelTextures(1); 
    42         setupObjectTextures(); 
    43          
    44          
     43        setupObjectTextures();       
    4544 
    4645        generator = new LevelGenerator(this, Level.Size, new Vector(20, 20)); 
    4746        generator.generateRandomLevel(5, 10); 
    4847        generator.initDungeon(); 
    49         generator.buildDungeon(); 
     48      //  generator.buildDungeon(); 
    5049        Room centerRoom = generator.getRoomAt((int)(generator.CenterRoom.X), (int)(generator.CenterRoom.Y)); 
    5150        Camera.Position = centerRoom.Position + new Vector(ROOMWIDTH / 2 + ROOMTHICKNESS / 2, -ROOMHEIGHT / 2 + ROOMTHICKNESS / 4); 
    5251        //Camera.ZoomToLevel(); 
     52        //Camera.Zoom(0.5); 
    5353 
    5454        player = new Player(this, Vector.Zero, playerPic); 
     
    9898    public void moveToRoom(Room room, int dir) 
    9999    { 
    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); 
    101101        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); 
    103105        player.Position = player.currentRoom.getDoor(dir).Position + RoomDirection.getOffsetFromWorldDir(dir) * 130; 
    104106    } 
     
    122124            Camera.Position = newPos; 
    123125            moveCamera = false; 
     126            oldRoom.destroyLevel(); 
    124127        } 
    125128    } 
     
    129132        player.Position = generator.getRoomAt(generator.CenterRoom).Position + new Vector(ROOMWIDTH / 2, -ROOMHEIGHT / 2); 
    130133        player.currentRoom = generator.getRoomAt(generator.CenterRoom); 
     134        player.currentRoom.buildLevel(); 
    131135        Add(player, 2); 
    132136    } 
     
    138142        generator.generateRandomLevel(10, 15); 
    139143        generator.initDungeon(); 
    140         generator.buildDungeon(); 
     144      //  generator.buildDungeon(); 
    141145        player.currentRoom = generator.getRoomAt(generator.CenterRoom); 
     146        player.currentRoom.buildLevel(); 
    142147    } 
    143148 
Note: See TracChangeset for help on using the changeset viewer.