public DoorTimerWrapper(Door DoorObject, ContentManager ContentArg, List<ScreenModel> modelsArg, GraphicsDeviceManager graphicsArg,CollisionCheckSystem User)
            : base()
        {
            //object that needs to be referenced in order to be closed
            DoorOfInterest = DoorObject;

            //args...girrrrrr
            Content = ContentArg;
            models = modelsArg;
            graphics = graphicsArg;
            UserRef = User;
        }
 //clears all models except for the door object being closed
 public static void ClearModelList(List<ScreenModel> models, Door DoorObject)
 {
     Door TempDoor = (Door)models.Find(
         delegate(ScreenModel DelegateObj)
         {
             return (DelegateObj == DoorObject);
         }
         );
     models.Clear();
     //add that door back to the model list
     models.Add(TempDoor);
 }
        //M Y PROGRAM SUCKS
        public static void DeleteRoom(Door ThisDoor, List<ScreenModel> models)
        {
            try
            {

                for (int x = 0; x < ThisDoor.LocalModels.Count; x++)
                {
                    if ((ThisDoor.LocalModels[x].GetType() == typeof(Door)) && (((Door)ThisDoor.LocalModels[x]).OpenTrue) && ((Door)ThisDoor.LocalModels[x] != ThisDoor.InverseDoor))
                        DeleteRoom((Door)ThisDoor.LocalModels[x], models);
                    models.Remove(ThisDoor.LocalModels[x]);
                }
            }
            catch
            {
                DeleteRoom(ThisDoor, models);
            }
        }
        public void LoadNewRoom(ContentManager Content, List<ScreenModel> models, GraphicsDeviceManager graphics)
        {
            if (this.ThisRoomModels.Count == 0)
                foreach (ScreenModel ThisModel in models)
                    this.ThisRoomModels.Add(ThisModel);

            //extracts the rooms from the file
            LocalModels = DataValues.LoadListOfModel(this.OutsideDoor, Content, graphics);

            //finds the door in the other room that matches this door, so that it can be used to make the other room relative to this one
            InverseDoor=this;
            foreach (ScreenModel model in LocalModels)
                if (model.GetType() == typeof(Door))
                {
                    ((Door)model).ThisRoomModels.Clear();
                    foreach (ScreenModel ThisModel in LocalModels)
                        ((Door)model).ThisRoomModels.Add(ThisModel);
                    if ((((Door)model).OutsideDoor.Equals(this.InsideDoor)) || (((Door)model).InsideDoor.Equals(this.OutsideDoor)) || InverseDoor==this)
                        InverseDoor = (Door)model;
                }

            //finds the relative difference in rotation and position
            Vector3 RoomRotation = this.modelRotation - InverseDoor.modelRotation+new Vector3(0,(float)Math.PI,0);
            Vector3 RoomPosition = this.Position - InverseDoor.Position;

            //adds the rooms to delete when the inverse door is closed(because it will be set to open when the room is created)
            InverseDoor.OpenTrue = true;

            if (InverseDoor != this)
            {
                InverseDoor.LocalModels.Clear();
                foreach (ScreenModel ThisModel in ThisRoomModels)
                    InverseDoor.LocalModels.Add(ThisModel);
            }

            //creates the transformation so that all objects are rotated about the door's position
            Matrix Transforms = Matrix.CreateRotationX(RoomRotation.X) * Matrix.CreateRotationY(RoomRotation.Y) * Matrix.CreateRotationZ(RoomRotation.Z) * Matrix.CreateTranslation(this.Position);

            //physically rotates the objects, and adds them to the models list
            foreach (ScreenModel model in LocalModels)
            {
                model.Position += RoomPosition;
                model.Position = Vector3.Transform(model.Position, Transforms);
                model.modelRotation += RoomRotation;
                models.Add(model);
                model.BoundingSetup();
            }

            //repositions all objects so that they are aligned to the door
            RoomPosition = this.Position - InverseDoor.Position;
            foreach (ScreenModel model in LocalModels)
                model.Position += RoomPosition;
        }
 public static OrientedBoundingBox GetBoundingBoxSurroundings(Door ThisDoor)
 {
     //makes a bounding box around the room
     Vector3 Min = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
     Vector3 Max = new Vector3(float.MinValue, float.MinValue, float.MinValue);
     foreach (ScreenModel ThisModel in ThisDoor.ThisRoomModels)
         if (ThisModel != ThisDoor)
             if(ThisModel.GetType() != typeof(Door))
                 foreach (OrientedBoundingBox Box in ThisModel.MovingBoxes)
                 {
                     foreach (Vector3 Corner in Box.GetRotatedCorners())
                     {
                         Max = Vector3.Max(Corner, Max);
                         Min = Vector3.Min(Corner, Min);
                     }
                 }
     return (new OrientedBoundingBox((Max + Min) / 2, (Max - Min) / 2, Quaternion.Identity));
 }
 //find the center point of a room to spawn the character
 public static Vector3 FindCenterRoom(Door ThisDoor)
 {
     OrientedBoundingBox BoundBox = GetBoundingBoxOther(ThisDoor);
     return(BoundBox.Center);
 }