/// <summary>
        /// Load the scene in the given ScenePackage.
        /// </summary>
        /// <param name="scenePackage">The ScenePackage to load.</param>
        public IEnumerable <SceneBuildStatus> loadScene(ScenePackage scenePackage, SceneBuildOptions options)
        {
            currentScenePackage = scenePackage;
            yield return(new SceneBuildStatus()
            {
                Message = "Setting up Resources"
            });

            sceneResourceManager.changeResourcesToMatch(scenePackage.ResourceManager);
            sceneResourceManager.initializeResources();

            currentScene = scenePackage.SceneDefinition.createScene();
            if (OnSceneLoading != null)
            {
                OnSceneLoading.Invoke(this, currentScene);
            }
            currentSimObjects = scenePackage.SimObjectManagerDefinition.createSimObjectManager(currentScene.getDefaultSubScene());
            foreach (var status in currentScene.buildSceneStatus(options))
            {
                yield return(status);
            }
            if (OnSceneLoaded != null)
            {
                OnSceneLoaded.Invoke(this, currentScene);
            }
        }
 /// <summary>
 /// Callback for when the scene is unloading. Will clear all SimObject instances.
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="scene"></param>
 private void SceneController_OnSceneUnloading(SceneController controller, SimScene scene)
 {
     if (simObjectManager != null)
     {
         simObjectManager.Dispose();
         simObjectManager = null;
         subScene         = null;
     }
 }
 /// <summary>
 /// Destroy the currently loaded scene. Does nothing if no scene is loaded.
 /// </summary>
 public void destroyScene()
 {
     if (currentScene != null)
     {
         if (OnSceneUnloading != null)
         {
             OnSceneUnloading.Invoke(this, currentScene);
         }
         currentSimObjects.Dispose();
         currentSimObjects = null;
         currentScene.Dispose();
         currentScene = null;
         if (OnSceneUnloaded != null)
         {
             OnSceneUnloaded.Invoke(this, null);
         }
     }
 }
Пример #4
0
        /// <summary>
        /// Load the scene in the given ScenePackage.
        /// </summary>
        /// <param name="scenePackage">The ScenePackage to load.</param>
        public IEnumerable <SceneBuildStatus> loadSceneCo(ScenePackage scenePackage, SceneBuildOptions options = SceneBuildOptions.SingleUseDefinitions)
        {
            this.scenePackage = scenePackage;
            yield return(new SceneBuildStatus()
            {
                Message = "Setting up Resources"
            });

            sceneResourceManager.changeResourcesToMatch(scenePackage.ResourceManager);
            sceneResourceManager.initializeResources();

            scene       = scenePackage.SceneDefinition.createScene();
            scene.Scope = pluginManager.GlobalScope.ServiceProvider.CreateScope();
            if (OnSceneLoading != null)
            {
                OnSceneLoading.Invoke(this, scene);
            }
            currentSimObjects = scenePackage.SimObjectManagerDefinition.createSimObjectManager(scene.getDefaultSubScene());
            if (dynamicMode)
            {
                foreach (var status in scene.buildSceneStatus(options))
                {
                    yield return(status);
                }
            }
            else
            {
                scene.buildStaticScene();
            }
            if (OnSceneLoaded != null)
            {
                OnSceneLoaded.Invoke(this, scene);
            }
            foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
            {
                debugInterface.createDebugInterface(pluginManager.RendererPlugin, scene.getDefaultSubScene());
            }
        }
Пример #5
0
 public void destroyScene()
 {
     if (scene != null)
     {
         foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
         {
             debugInterface.destroyDebugInterface(pluginManager.RendererPlugin, scene.getDefaultSubScene());
         }
         if (OnSceneUnloading != null)
         {
             OnSceneUnloading.Invoke(this, scene);
         }
         currentSimObjects.Dispose();
         currentSimObjects = null;
         scene.Scope.Dispose();
         scene.Dispose();
         scene = null;
         if (OnSceneUnloaded != null)
         {
             OnSceneUnloaded.Invoke(this, null);
         }
     }
 }
Пример #6
0
 public SimObjectsMenu(IFsConnect fsConnect) : base(fsConnect)
 {
     _simObjectManager               = new SimObjectManager <PlaneInfoResponse>(_fsConnect, Definitions.PlaneInfo, Requests.SimObjects);
     _simObjectManager.Radius        = 100 * 1000;
     _simObjectManager.SimObjectType = FsConnectSimobjectType.Aircraft;
 }
 /// <summary>
 /// Callback for when the scene is loading. Will create all instances
 /// and add them to their selectables.
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="scene"></param>
 private void SceneController_OnSceneLoading(SceneController controller, SimScene scene)
 {
     this.subScene    = scene.getDefaultSubScene();
     simObjectManager = simObjectManagerDefiniton.createSimObjectManager(scene.getDefaultSubScene());
 }
Пример #8
0
 public GameHandler()
 {
     simulationObjectManager = new SimObjectManager();
 }