示例#1
0
        public WorldObject GetCamera()
        {
            Camera.AddService(typeof(NameService), new NameService("Fly", this.form.game));
            Camera.AddService(typeof(PositionService), GetCameraInitialPosition(Camera));
            Camera.AddService(typeof(CameraService), GetCameraService(Camera));
            //Camera.AddService(typeof(DrawService), new DrawService(Camera, this.form.game));
            //switch (this.UpdateTypes.Text)
            //{
            //    //case "Keyboard":
            //    //    Camera.AddService(typeof(UpdateCameraKeyboard), new UpdateCameraKeyboard(Camera, form.game, true));
            //    //    return Camera;

            //    default:
            //        return null;
            //}
            return(Camera);
        }
示例#2
0
        public WorldObject BuildCamera()
        {
            WorldObject cam = new WorldObject();

            cam.AddService(typeof(NameService), new NameService("Fly", this.game));
            PositionService pos = new PositionService(this.game);

            pos.position  = new Vector3(0, 0, 0);
            pos.reference = new Vector3(0, 0, 100);
            cam.AddService(typeof(PositionService), pos);
            //CameraService camServ = new CameraService(cam, this.game, 0.785398f, 1.33333f, 0.5f, 100f);
            CameraService camServ = new CameraService(cam, this.game, -5, 5, -5, 5, 0.5f, 100f);

            cam.AddService(typeof(CameraService), camServ);
            cam.AddService(typeof(DrawService), new DrawService(cam, this.game));
            //cam.AddService(typeof(UpdateCameraKeyboard), new UpdateCameraKeyboard(cam, this.game));
            return(cam);
        }
示例#3
0
        /* Build a .FBX model to a .XNB file */
        public void LoadModel(string fileName)
        {
            NameService name = (NameService)wObj.GetService(typeof(NameService));

            Cursor = Cursors.WaitCursor;
            /* Prepare the content builder project */
            this.createWorld.contentBuilder.Add(fileName, name.name, null, "ModelProcessor");
            /* Build the model */
            string buildError = this.createWorld.contentBuilder.Build();

            if (buildError == null)
            {
                if (!wObj.ContainService(typeof(DrawService)))
                {
                    /* Try load the Model and adress it as a Service to the World Object */
                    Model model = (Model)contentManager.Load <Model>(name.name);
                    wObj.AddService(typeof(Model), model);
                    DrawService toDrawService = new DrawService(wObj, this.createWorld.game);
                    wObj.AddService(typeof(DrawService), toDrawService);
                }
                else
                {
                    DrawService toDrawService = (DrawService)wObj.GetService(typeof(DrawService));
                    /* Try load the Model and adress it as a Service to the World Object */
                    Model model = (Model)contentManager.Load <Model>(name.name);
                    toDrawService.model = model;
                    wObj.RemoveService(typeof(Model));
                    wObj.AddService(typeof(Model), model);
                }
            }
            else
            {
                ProblemLoadingModel probL = new ProblemLoadingModel();
                probL.ShowDialog();
                this.StringModel.Text = "";
            }
            Cursor = Cursors.Arrow;
        }