Example #1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            follow = !follow;
        }

        //2 button
        if (!draw.Keyboard && !com.IsWritingPen())
        {
            if ((com.ButtonPressed(1) || Input.GetKey(KeyCode.X)) && !com.ButtonPressed(0))
            {
                temporary = true;
            }
            if (com.ButtonPressedUp(1) || Input.GetKeyUp(KeyCode.X))
            {
                temporary = false;
            }
        }

        //Writing pen
        if (!draw.Keyboard && com.IsWritingPen())
        {
            if (Input.GetKey(KeyCode.X) && (!com.ButtonPressed(0)))
            {
                temporary = true;
            }
            if (Input.GetKeyUp(KeyCode.X))
            {
                temporary = false;
            }
        }

        //Keyboard
        if (draw.Keyboard)
        {
            if (Input.GetKey(KeyCode.X) && !Input.GetKey(KeyCode.Z))
            {
                temporary = true;
            }
            if (Input.GetKeyUp(KeyCode.X))
            {
                temporary = false;
            }
        }
    }
Example #2
0
    void Update()
    {
        //Delta for rotating
        delta = msg.LoadDeltas();



        if (Keyboard)
        {
            //*************************************************************************
            //                               KEYBOARD
            //************************************************************************ */
            //Destroying
            if (Input.GetKey(KeyCode.X) && Input.GetKey(KeyCode.Z))
            {
                DestroyAll();
            }

            //Rotating
            if (Input.GetKey(KeyCode.X) && !Input.GetKey(KeyCode.Z))
            {
                RotateAll();
            }

            //Drawing
            if (Input.GetKey(KeyCode.Z) && !Input.GetKey(KeyCode.X))
            {
                Draw();
            }
            else
            {
                ClearMesh();
            }

            //Drawing creation
            if (Input.GetKeyUp(KeyCode.Z))
            {
                CreateMesh();
            }
        }
        else
        {
            //************************************************************************
            //                               PEN
            //************************************************************************
            if (msg.IsWritingPen())
            {
                //************************************************************************
                //                               WRITING PEN
                //************************************************************************
                //Destroying
                if (Input.GetKey(KeyCode.X) && (msg.ButtonPressed(0) || Input.GetKey(KeyCode.Z)))
                {
                    DestroyAll();
                }

                //Rotating
                if (Input.GetKey(KeyCode.X) && (!msg.ButtonPressed(0) || !Input.GetKey(KeyCode.Z)))
                {
                    RotateAll();
                }

                //Drawing
                if ((msg.ButtonPressed(0) || Input.GetKey(KeyCode.Z)) && !Input.GetKey(KeyCode.X))
                {
                    Draw();
                }
                else
                {
                    ClearMesh();
                }

                //Drawing creation
                if (msg.ButtonPressedUp(0) || Input.GetKeyUp(KeyCode.Z))
                {
                    CreateMesh();
                }
            }
            else
            {
                //Drawing for working

                if ((msg.ButtonPressed(0) || Input.GetKey(KeyCode.Z)) && (!msg.ButtonPressed(1) && !Input.GetKey(KeyCode.X)))
                {
                    Draw();
                }
                else
                {
                    ClearMesh();
                }


                //Drawing for not working

                /*
                 * if(msg.ButtonPressed(0) || msg.ButtonPressed(1) || Input.GetKey(KeyCode.Z)) {
                 *  Draw();
                 * } else {
                 *  ClearMesh();
                 * }
                 */


                //************************************************************************
                //                               2-Buttons PEN
                //************************************************************************
                //Destroying
                if ((msg.ButtonPressed(1) || Input.GetKey(KeyCode.X)) && (msg.ButtonPressed(0) || Input.GetKey(KeyCode.Z)))
                {
                    DestroyAll();
                }

                //Destroy broken

                /*
                 * if ((Input.GetKey(KeyCode.X)) && (Input.GetKey(KeyCode.Z))) {
                 *   DestroyAll();
                 *  // Draw();
                 * }*/

                //Rotate broken

                /*
                 * if ((Input.GetKey(KeyCode.X)) && (!Input.GetKey(KeyCode.Z))) {
                 *  RotateAll();
                 *  // Draw();
                 * }*/

                //Rotating
                if ((msg.ButtonPressed(1) || Input.GetKey(KeyCode.X)) && (!msg.ButtonPressed(0) || !Input.GetKey(KeyCode.Z)))
                {
                    RotateAll();
                    // Draw();
                }



                //Drawing creation normla buttons

                if (msg.ButtonPressedUp(0) || Input.GetKeyUp(KeyCode.Z))
                {
                    CreateMesh();
                }


                //Drawing broken

                /*
                 * if(msg.ButtonPressedUp(0) && (!msg.ButtonPressed(0) && !msg.ButtonPressed(1) && !Input.GetKey(KeyCode.Z))) {
                 *  CreateMesh();
                 * }
                 *
                 * if (msg.ButtonPressedUp(1) && (!msg.ButtonPressed(0) && !msg.ButtonPressed(1) && !Input.GetKey(KeyCode.Z))) {
                 *  CreateMesh();
                 * }
                 *
                 * if (Input.GetKeyUp(KeyCode.Z) && (!msg.ButtonPressed(0) && !msg.ButtonPressed(1) && !Input.GetKey(KeyCode.Z))) {
                 *  CreateMesh();
                 * }*/
            }
        }
    }
Example #3
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            follow = !follow;
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            //  Vector3 newPos = startingPosition - Camera.main.transform.position;
            //  this.transform.parent.position = newPos;
            UnityEngine.XR.InputTracking.Recenter();
        }

        if (Input.GetKeyDown(KeyCode.V))
        {
            if (cam1.gameObject.activeSelf)
            {
                //Camera.main.GetComponent<Camera>().enabled = true;
                cam1.gameObject.SetActive(false);
            }
            else
            {
                // Camera.main.GetComponent<Camera>().enabled = false;
                cam1.gameObject.SetActive(true);
            }
        }

        //2 button
        if (!draw.Keyboard && !com.IsWritingPen())
        {
            if ((com.ButtonPressed(1) || Input.GetKey(KeyCode.X)) && !com.ButtonPressed(0))
            {
                temporary = true;
            }
            if (com.ButtonPressedUp(1) || Input.GetKeyUp(KeyCode.X))
            {
                temporary = false;
            }
        }

        //Writing pen
        if (!draw.Keyboard && com.IsWritingPen())
        {
            if (Input.GetKey(KeyCode.X) && (!com.ButtonPressed(0)))
            {
                temporary = true;
            }
            if (Input.GetKeyUp(KeyCode.X))
            {
                temporary = false;
            }
        }

        //Keyboard
        if (draw.Keyboard)
        {
            if (Input.GetKey(KeyCode.X) && !Input.GetKey(KeyCode.Z))
            {
                temporary = true;
            }
            if (Input.GetKeyUp(KeyCode.X))
            {
                temporary = false;
            }
        }
    }
Example #4
0
    void Update()
    {
        //Delta for rotating
        delta = msg.LoadDeltas();

        //Top view camera showing
        if (Input.GetKey(KeyCode.V))
        {
            cameraUp.SetActive(true);
        }
        else
        {
            cameraUp.SetActive(false);
        }

        if (Keyboard)
        {
            //*************************************************************************
            //                               KEYBOARD
            //************************************************************************ */
            //Destroying
            if (Input.GetKey(KeyCode.X) && Input.GetKey(KeyCode.Z))
            {
                DestroyAll();
            }

            //Rotating
            if (Input.GetKey(KeyCode.X) && !Input.GetKey(KeyCode.Z))
            {
                RotateAll();
            }

            //Drawing
            if (Input.GetKey(KeyCode.Z) && !Input.GetKey(KeyCode.X))
            {
                Draw();
            }
            else
            {
                ClearMesh();
            }

            //Drawing creation
            if (Input.GetKeyUp(KeyCode.Z))
            {
                CreateMesh();
            }
        }
        else
        {
            //************************************************************************
            //                               PEN
            //************************************************************************
            if (msg.IsWritingPen())
            {
                //************************************************************************
                //                               WRITING PEN
                //************************************************************************
                //Destroying
                if (Input.GetKey(KeyCode.X) && (msg.ButtonPressed(0) || Input.GetKey(KeyCode.Z)))
                {
                    DestroyAll();
                }

                //Rotating
                if (Input.GetKey(KeyCode.X) && (!msg.ButtonPressed(0) || !Input.GetKey(KeyCode.Z)))
                {
                    RotateAll();
                }

                //Drawing
                if ((msg.ButtonPressed(0) || Input.GetKey(KeyCode.Z)) && !Input.GetKey(KeyCode.X))
                {
                    Draw();
                }
                else
                {
                    ClearMesh();
                }

                //Drawing creation
                if (msg.ButtonPressedUp(0) || Input.GetKeyUp(KeyCode.Z))
                {
                    CreateMesh();
                }
            }
            else
            {
                //Drawing
                if ((msg.ButtonPressed(0) || Input.GetKey(KeyCode.Z)) && (!msg.ButtonPressed(1) && !Input.GetKey(KeyCode.X)))
                {
                    Draw();
                }
                else
                {
                    ClearMesh();
                }
                //************************************************************************
                //                               2-Buttons PEN
                //************************************************************************
                //Destroying
                if ((msg.ButtonPressed(1) || Input.GetKey(KeyCode.X)) && (msg.ButtonPressed(0) || Input.GetKey(KeyCode.Z)))
                {
                    DestroyAll();
                }

                //Rotating
                if ((msg.ButtonPressed(1) || Input.GetKey(KeyCode.X)) && (!msg.ButtonPressed(0) || !Input.GetKey(KeyCode.Z)))
                {
                    RotateAll();
                }



                //Drawing creation
                if (msg.ButtonPressedUp(0) || Input.GetKeyUp(KeyCode.Z))
                {
                    CreateMesh();
                }
            }
        }
    }