private void UpdateCompass()
 {
     if (this.m_compassDoor == null && this.CurrentRoom.Name != "Ending" && this.CurrentRoom.Name != "Boss" && this.CurrentRoom.Name != "Start" && this.CurrentRoom.Name != "Tutorial" && this.CurrentRoom.Name != " ChallengeBoss")
     {
         Console.WriteLine("Creating new bonus room for compass");
         RoomObj roomObj = null;
         EnemyObj enemyObj = null;
         List<RoomObj> list = new List<RoomObj>();
         foreach (RoomObj current in this.m_roomList)
         {
             bool flag = false;
             foreach (EnemyObj current2 in current.EnemyList)
             {
                 if (current2.IsWeighted)
                 {
                     flag = true;
                     break;
                 }
             }
             if (current.Name != "Ending" && current.Name != "Tutorial" && current.Name != "Boss" && current.Name != "Secret" && current.Name != "Bonus" && flag && current.Name != "ChallengeBoss")
             {
                 list.Add(current);
             }
         }
         if (list.Count > 0)
         {
             roomObj = list[CDGMath.RandomInt(0, list.Count - 1)];
             int num = 0;
             while (enemyObj == null || !enemyObj.IsWeighted)
             {
                 enemyObj = roomObj.EnemyList[num];
                 num++;
             }
             DoorObj doorObj = new DoorObj(roomObj, 120, 180, GameTypes.DoorType.OPEN);
             doorObj.Position = enemyObj.Position;
             doorObj.IsBossDoor = true;
             doorObj.DoorPosition = "None";
             doorObj.AddCollisionBox(0, 0, doorObj.Width, doorObj.Height, 0);
             doorObj.AddCollisionBox(0, 0, doorObj.Width, doorObj.Height, 2);
             float num2 = 3.40282347E+38f;
             TerrainObj terrainObj = null;
             foreach (TerrainObj current3 in roomObj.TerrainObjList)
             {
                 if (current3.Y >= doorObj.Y && current3.Y - doorObj.Y < num2 && CollisionMath.Intersects(current3.Bounds, new Rectangle((int)doorObj.X, (int)(doorObj.Y + (current3.Y - doorObj.Y) + 5f), doorObj.Width, doorObj.Height / 2)))
                 {
                     num2 = current3.Y - doorObj.Y;
                     terrainObj = current3;
                 }
             }
             if (terrainObj != null)
             {
                 doorObj.UpdateCollisionBoxes();
                 if (terrainObj.Rotation == 0f)
                 {
                     doorObj.Y = terrainObj.Y - ((float)doorObj.TerrainBounds.Bottom - doorObj.Y);
                 }
                 else
                 {
                     this.HookEnemyToSlope(doorObj, terrainObj);
                 }
             }
             roomObj.DoorList.Add(doorObj);
             roomObj.LinkedRoom = this.m_roomList[this.m_roomList.Count - 1];
             roomObj.LinkedRoom.LinkedRoom = roomObj;
             roomObj.LinkedRoom.LevelType = roomObj.LevelType;
             string cornerTextureString = "CastleCorner_Sprite";
             string cornerLTextureString = "CastleCornerL_Sprite";
             string cornerTextureString2 = "TowerCorner_Sprite";
             string cornerLTextureString2 = "TowerCornerL_Sprite";
             string cornerTextureString3 = "DungeonCorner_Sprite";
             string cornerLTextureString3 = "DungeonCornerL_Sprite";
             string cornerTextureString4 = "GardenCorner_Sprite";
             string cornerLTextureString4 = "GardenCornerL_Sprite";
             if (Game.PlayerStats.Traits.X == 32f || Game.PlayerStats.Traits.Y == 32f)
             {
                 string text = "NeoCorner_Sprite";
                 string text2 = "NeoCornerL_Sprite";
                 cornerLTextureString3 = (cornerLTextureString = (cornerLTextureString2 = (cornerLTextureString4 = text2)));
                 cornerTextureString3 = (cornerTextureString = (cornerTextureString2 = (cornerTextureString4 = text)));
             }
             foreach (BorderObj current4 in roomObj.LinkedRoom.BorderList)
             {
                 switch (roomObj.LinkedRoom.LevelType)
                 {
                 case GameTypes.LevelType.GARDEN:
                     current4.SetBorderTextures(this.m_gardenBorderTexture, cornerTextureString4, cornerLTextureString4);
                     current4.TextureOffset = new Vector2(0f, -18f);
                     continue;
                 case GameTypes.LevelType.DUNGEON:
                     current4.SetBorderTextures(this.m_dungeonBorderTexture, cornerTextureString3, cornerLTextureString3);
                     continue;
                 case GameTypes.LevelType.TOWER:
                     current4.SetBorderTextures(this.m_towerBorderTexture, cornerTextureString2, cornerLTextureString2);
                     continue;
                 }
                 current4.SetBorderTextures(this.m_castleBorderTexture, cornerTextureString, cornerLTextureString);
             }
             this.m_compassDoor = doorObj;
         }
     }
     if (this.m_compassDoor != null)
     {
         this.m_compass.Rotation = CDGMath.AngleBetweenPts(this.m_player.Position, new Vector2((float)this.m_compassDoor.Bounds.Center.X, (float)this.m_compassDoor.Bounds.Center.Y));
     }
 }