// Remove a cached object from update loop, does not deallocate. Physics bodies crushed and moved to (-1,-1) protected void Deactivate(string key) { GameObject gameObject; if (!CachedGameObjects.ContainsKey(key)) { Console.Error.WriteLine("Room : \"{0}\" : Remove() : Keyname \"{1}\" not found in loaded objects", Key, key); return; } gameObject = CachedGameObjects[key]; if (gameObject.Active) { ActiveGameObjects.Remove(gameObject); gameObject.PreDeactivate(); if (gameObject.Drawable) { DrawableGameObjects.Remove(gameObject); } if (gameObject.Body != null) { gameObject.Body.BoxCollider.Data = CollisionCategory.none; foreach (Hitbox hitbox in gameObject.Body.ChildHitboxes.Values) { World.RemoveHitbox(hitbox); } } } }