Esempio n. 1
0
        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");
            }
        }
Esempio n. 2
0
        private void CreatePlaneMenuItem_Click(object sender, RoutedEventArgs e)
        {
            if (Level != null)
            {
                CreatePlaneWindow createPlaneWindow = new CreatePlaneWindow();
                createPlaneWindow.Owner = this;

                if (createPlaneWindow.ShowDialog().Value)
                {
                    GameApplicationTools.Actors.Primitives.Plane plane = new GameApplicationTools.Actors.Primitives.Plane(createPlaneWindow.ID, createPlaneWindow.Texture);
                    plane.Position = createPlaneWindow.Position;
                    plane.Scale = createPlaneWindow.Scale;
                    plane.LoadContent();
                    sceneGraph.RootNode.Children.Add(plane);
                    LoadWorldView();
                }
            }
            else
            {
                MessageBox.Show("Please create or load a level first before you add any actor");
            }
        }