예제 #1
0
        public void undoTest()
        {
            ManipulationController t      = ManipulationController.getInstance();
            PrivateObject          param0 = new PrivateObject(t);
            Controller_Accessor    target = new Controller_Accessor(param0);

            PixelState  p      = PixelState.getInstance();
            Bitmap      b      = new Bitmap(10, 10);
            Image       img    = (Image)b;
            ImageObject imgObj = new ImageObject(img, ImageManipulatorType.Name.GRAYSCALE);

            PictureBox pictureBox1 = new PictureBox();

            pictureBox1.Image = img;
            target.setPictureBox(pictureBox1);



            Bitmap      c       = new Bitmap(13, 14);
            Image       img2    = (Image)c;
            ImageObject imgObj2 = new ImageObject(img, ImageManipulatorType.Name.GRAYSCALE);

            p.add(imgObj2);

            target.undo();
            Image i1 = imgObj2.get_Image();
            Image i2 = Controller_Accessor.pic.Image;

            //  Erwartet:<System.Drawing.Bitmap>. Tatsächlich:<System.Drawing.Bitmap> .
            Assert.AreEqual(i1, i2, "Das System wirft einen Fehler weil er bekommt was er erwartet. ALLES KLAAR!!! :(");
        }
    // Update is called once per frame
    void Update()
    {
        // poll and do actions
        if (CollidingObject)
        {
            Quaternion             angularSpeed    = Quaternion.Inverse(previousAngle) * transform.rotation;
            Vector3                linearSpeed     = transform.position - previousPosition;
            Rigidbody              rb              = CollidingObject.GetComponent <Rigidbody>();
            ManipulationController otherController = OtherController.GetComponent <ManipulationController>();
            //First check if the other side is grabing
            if (Input.GetMouseButton((int)ControllerSide))
            {
                bool isSameObject = false;
                if (otherController.isHolding)
                {
                    isSameObject = otherController.CollidingObject.Equals(CollidingObject);
                }
                if (!isHolding && !isSameObject)
                {
                    rb.isKinematic = true;
                    rb.transform.SetParent(gameObject.transform);
                    UnHighlightObject();
                }
                isHolding = true;
            }
            else if (Input.GetMouseButtonUp((int)ControllerSide))
            {
                isHolding = false;
                bool isSameObject = false;
                if (otherController.isHolding)
                {
                    isSameObject = otherController.CollidingObject.Equals(CollidingObject);
                }
                if (!isSameObject)
                {
                    rb.transform.SetParent(GameObject.Find("/World/Environment/Interactables").transform);
                    rb.isKinematic     = false;
                    rb.velocity        = linearSpeed / Time.deltaTime / rb.mass;
                    rb.angularVelocity = angularSpeed.eulerAngles / Time.deltaTime / rb.mass;
                    HighlightObject();
                }
                else
                {
                    rb.transform.SetParent(otherController.transform);
                }
            }
        }

        //Spaghetti Sanity check for isHolding
        if (isHolding)
        {
            if (!CollidingObject)
            {
                isHolding = false;
            }
        }

        previousPosition = transform.position;
        previousAngle    = transform.rotation;
    }
예제 #3
0
        public void getInstanceTest()
        {
            ManipulationController expected = null; // TODO: Passenden Wert initialisieren
            ManipulationController actual;

            actual = ManipulationController.getInstance();
            Assert.AreNotEqual(expected, actual);

            Assert.IsInstanceOfType(actual, typeof(ManipulationController));
        }
예제 #4
0
        public void setPictureBoxTest()
        {
            ManipulationController t      = ManipulationController.getInstance();
            PrivateObject          param0 = new PrivateObject(t);
            Controller_Accessor    target = new Controller_Accessor(param0);

            PictureBox pictureBox1 = new PictureBox();

            t.setPictureBox(pictureBox1);

            Assert.AreSame(pictureBox1, Controller_Accessor.pic);
        }
예제 #5
0
    void Start()
    {
        GameObject skeleton = GetComponent <ManipulationController>().SkeletonContainer;

        root  = skeleton.transform.GetChild(0).gameObject;
        model = skeleton.transform.parent.gameObject;

        manipulator = GetComponent <ManipulationController>();

        playback = model.AddComponent <Animation>();

        reset();
    }
예제 #6
0
        public void setMainFormTest()
        {
            ManipulationController t = ManipulationController.getInstance();

            Form1 form = new Form1(); // TODO: Passenden Wert initialisieren

            t.setMainForm(form);

            PrivateObject       param0 = new PrivateObject(t);            // TODO: Passenden Wert initialisieren
            Controller_Accessor target = new Controller_Accessor(param0); // TODO: Passenden Wert initialisieren

            Assert.AreSame(form, target.mainForm);
        }
예제 #7
0
    void Start()
    {
        controller  = GetComponent <MenuController>();
        manipulator = GetComponent <ManipulationController>();
        clipManager = GetComponent <ClipManager>();

        callbacks = new Dictionary <string, Action>()
        {
            { CALLBACK.STANDBY, () => {
                  manipulator.AssignJob(JOB.STANDBY);
              } },
            { CALLBACK.ROTATE_JOINT, () => {
                  manipulator.AssignJob(JOB.ROTATE);
              } },
            { CALLBACK.OPEN_ADDITIONAL, () => {
                  controller.ShowAdditionalMenu(true);
              } },
            { CALLBACK.CLOSE_ADDITIONAL, () => {
                  controller.ShowAdditionalMenu(false);
                  Reset();
              } },
            { CALLBACK.DISCARD_CHANGES, () => {
                  clipManager.Undo(0);
                  Reset();
              } },
            { CALLBACK.SAVE_CHANGES, () => {
                  clipManager.SaveRotation(manipulator.HighlightedJoint);
                  Reset();
              } },
            { CALLBACK.UNDO, () => {
                  clipManager.Undo(1);
                  Reset();
              } },
        };

        startNode = new MenuNode("Start", null, new Dictionary <string, MenuNode>()
        {
            { OPTION.UP, new MenuNode("Undo the last change.", CALLBACK.UNDO, null) },
            { OPTION.MIDDLE, new MenuNode("Open additional actions menu.", CALLBACK.OPEN_ADDITIONAL, new Dictionary <string, MenuNode>()
                {
                    { OPTION.MIDDLE, new MenuNode("Gaze at a button to execute action.", null, null) },
                    { OPTION.DOWN, new MenuNode("Exit additional actions menu.", CALLBACK.CLOSE_ADDITIONAL, null) }
                }) },
            { OPTION.DOWN, new MenuNode("Touch the joint you wish to animate.", null, new Dictionary <string, MenuNode>()
                {
                    { OPTION.UP, new MenuNode("Do you want to work with this joint?.", null, null) },
                    { OPTION.MIDDLE, new MenuNode("Rotate selected joint.", CALLBACK.ROTATE_JOINT, new Dictionary <string, MenuNode>()
                        {
                            { OPTION.UP, new MenuNode("Discard changes.", CALLBACK.STANDBY, new Dictionary <string, MenuNode>()
                                {
                                    { OPTION.UP, new MenuNode("Are you sure about that?", null, null) },
                                    { OPTION.MIDDLE, new MenuNode("Yes, discard the changes.", CALLBACK.DISCARD_CHANGES, null) },
                                    { OPTION.DOWN, new MenuNode("I changed my mind, save the changes.", CALLBACK.SAVE_CHANGES, null) }
                                }) },
                            { OPTION.MIDDLE, new MenuNode("Adjust joint rotation to your liking.", null, null) },
                            { OPTION.DOWN, new MenuNode("Save changes.", CALLBACK.SAVE_CHANGES, null) }
                        }) }
                }) }
        });

        Reset();
    }