public void RegisterActors() { #region 3D Stuff Camera camera = new Camera("mainMenuCamera", new Vector3(0, 50, 600), Vector3.Zero); camera.LoadContent(); CameraManager.Instance.CurrentCamera = "mainMenuCamera"; SkySphere sky = new SkySphere("SkySphereMainMenuView", "space", 10000f); sky.Position = Vector3.Zero; sky.LoadContent(); SceneGraphManager.RootNode.Children.Add(sky); Planet planet = new Planet("GamePlanetEarth",700f); planet.Position = new Vector3(-1200, 0, -600); planet.LoadContent(); SceneGraphManager.RootNode.Children.Add(planet); /* Box box = new Box("box", 1f); box.Position = new Vector3(0, 0, 0); //box.Offset = new Vector3(0, 0, 0); box.LoadContent(); Sphere sphere = new Sphere("sphereBox", 2f); sphere.Offset = new Vector3(0, 0, 0); sphere.LoadContent(); box.Children.Add(sphere);*/ //SceneGraphManager.RootNode.Children.Add(box); #endregion #region UI Stuff TextElement headline = new TextElement("TextElementHeadline", new Vector2(400, 100), Color.Yellow, "Space Commander", ResourceManager.Instance.GetResource<SpriteFont>("Arial")); headline.Scale = 1f; UIManager.Instance.AddActor(headline); Button startNewGameButton = new Button("ButtonStartNewGame", new Vector2(400, 150), ResourceManager.Instance.GetResource<Texture2D>("startnewgame_button"), 312, 83); startNewGameButton.LoadContent(); UIManager.Instance.AddActor(startNewGameButton); #endregion }
private void NewMenuItem_Click(object sender, RoutedEventArgs e) { if (EditorStatus == EditorStatus.IDLE) { NewLevelWindow newLevelWindow = new NewLevelWindow(); newLevelWindow.Owner = this; if (newLevelWindow.ShowDialog().Value) { if (newLevelWindow.Filename != "") { Level = new Level(); Level.Name = newLevelWindow.Filename; LevelStatus.Content = "Level: " + newLevelWindow.Filename; if (newLevelWindow.CreateCamera) { Camera camera = new Camera("default.Camera", newLevelWindow.CameraPosition, newLevelWindow.CameraTarget); camera.LoadContent(); EditorCamera editorCamera = new EditorCamera("editor.Camera", newLevelWindow.CameraPosition, newLevelWindow.CameraTarget); editorCamera.LoadContent(); CameraManager.Instance.CurrentCamera = "editor.Camera"; if (newLevelWindow.CreateAxis) { Axis axis = new Axis("default.Axis", 1f); axis.LoadContent(); sceneGraph.RootNode.Children.Add(axis); } if (newLevelWindow.CreatePlane) { GameApplicationTools.Actors.Primitives.Plane plane = new GameApplicationTools.Actors.Primitives.Plane("defaultPlane", "kachel2_bump"); plane.LoadContent(); sceneGraph.RootNode.Children.Add(plane); } LoadWorldView(); } } } } else { MessageBox.Show("Please wait till the Editor is fully loaded"); } }
/// <summary> /// Just adds a specific camera id to our internal /// list. /// </summary> /// <param name="ID"></param> public void AddCamera(String ID, Camera obj) { _cameras.Add(ID, obj); }