/// <summary> /// Pauses a scene. /// A paused scene is continued to be rendered but is not updated. /// </summary> /// <param name="id">The ID of the scene.</param> public void PauseScene(int id) { // Check if the scene exists. if (scenes.ContainsKey(id)) { // Get scene as scene state. ISceneState state = (ISceneState)scenes[id]; // If scene is already paused or stopped, don't attempt to pause; return. if (state.State == SceneState.Paused || state.State == SceneState.Stopped) { return; } // Pause scene. IReadOnlyList <IEntity> entities = state.Pause(); // Remove entities from collision, input and update systems. foreach (IEntity entity in entities) { collisionSystem.RemoveEntity(entity.Id); inputSystem.RemoveEntity(entity.Id); updateSystem.RemoveEntity(entity.Id); } } }