Example #1
0
        /// <summary>
        /// Create and return a new SimScene from this definition.
        /// </summary>
        /// <returns>A new scene configured like this definition.</returns>
        public SimScene createScene()
        {
            SimScene scene = new SimScene();

            foreach (SimElementManagerDefinition elementManagerDef in elementManagers)
            {
                scene.addSimElementManager(elementManagerDef.createSimElementManager());
            }
            foreach (SimSubSceneDefinition subSceneDef in subSceneDefinitions.Values)
            {
                subSceneDef.createSubScene(scene);
            }
            if (DefaultSubScene != null)
            {
                SimSubScene subScene = scene.getSubScene(DefaultSubScene);
                if (subScene != null)
                {
                    scene.setDefaultSubScene(subScene);
                }
                else
                {
                    Log.Default.sendMessage("The defined default scene {0} can not be found in the created scene. No default set.", LogLevel.Warning, "Engine", DefaultSubScene);
                }
            }
            else
            {
                Log.Default.sendMessage("No default scene defined. No default set.", LogLevel.Warning, "Engine");
            }
            return(scene);
        }
 void sceneController_OnSceneUnloading(SceneController controller, Engine.ObjectManagement.SimScene scene)
 {
     if (debugSurface != null)
     {
         renderer.destroyDebugDrawingSurface(debugSurface);
     }
 }
Example #3
0
        /// <summary>
        /// Create a new SimSubScene and add it to scene.
        /// </summary>
        /// <param name="scene">The scene to add the sub scene to.</param>
        /// <returns>The newly created sub scene.</returns>
        public SimSubScene createSubScene(SimScene scene)
        {
            SimSubScene subscene = new SimSubScene(Name, scene);

            foreach (SimSubSceneBinding elementManager in bindings)
            {
                SimElementManager manager = scene.getSimElementManager(elementManager.SimElementManager.Name);
                if (manager != null)
                {
                    subscene.addSimElementManager(manager);
                }
                else
                {
                    Log.Default.sendMessage("Could not find SimElementManager called {0}. This has not been added to the scene.", LogLevel.Warning, "Engine", elementManager);
                }
            }
            scene.addSimSubScene(subscene);
            return(subscene);
        }
Example #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">The name of the SimSubScene.</param>
 public SimSubScene(String name, SimScene scene)
 {
     this.name  = name;
     this.scene = scene;
 }