Ejemplo n.º 1
0
 void Start()
 {
     Divide = 50.0f;
     this.transform.position = new Vector3(0f, 1.5f, 0f);
     msg         = GameObject.Find("Controler").GetComponent <COM>();
     lastWriting = msg.IsWritingPen();
 }
Ejemplo n.º 2
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;
            }
        }
    }
Ejemplo n.º 3
0
    void Update()
    {
        if (lastSensitivity != kursor.Divide)
        {
            Sequence sequence = DOTween.Sequence();
            sequence.Append(DOTween.ToAlpha(() => actualColor, x => actualColor = x, 1, 1));
            sequence.Append(DOTween.ToAlpha(() => actualColor, x => actualColor = x, 0, 1));
        }

        if (lastDevice != com.IsWritingPen())
        {
            Sequence sequence = DOTween.Sequence();
            sequence.Append(DOTween.ToAlpha(() => deviceColor, x => deviceColor = x, 1, 1));
            sequence.Append(DOTween.ToAlpha(() => deviceColor, x => deviceColor = x, 0, 1));
        }
        lastDevice      = com.IsWritingPen();
        lastSensitivity = kursor.Divide;
    }
Ejemplo n.º 4
0
 void Start()
 {
     if (!OnDeltas)
     {
         Divide = 8000;
     }
     else
     {
         Divide = 2500;
     }
     Divide   = 3000;
     startPos = new Vector3(0.3f, 0.6f, -3.445f);
     this.transform.position = startPos;
     msg         = Camera.main.GetComponent <COM>();
     lastWriting = msg.IsWritingPen();
 }
Ejemplo n.º 5
0
 void Start()
 {
     if (!OnDeltas)
     {
         Divide = 8000;
     }
     else
     {
         Divide = 400;
     }
     if (SceneManager.GetActiveScene().name == "DrawingVR")
     {
     }
     else
     {
         Divide   = 1950;
         startPos = new Vector3(0f, 0.0f, -10.0f);
         this.transform.position = startPos;
     }
     msg         = Camera.main.GetComponent <COM>();
     lastWriting = msg.IsWritingPen();
 }
Ejemplo n.º 6
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();
                 * }*/
            }
        }
    }
Ejemplo n.º 7
0
    void Update()
    {
        //Do zmiany
        if (msg.IsWritingPen())
        {
            OnDeltas = false;
        }
        else
        {
            OnDeltas = true;
        }
        if (Input.GetKey(KeyCode.R))
        {
            this.transform.position = startPos;
            msg.SendError();
        }
        if (!OnDeltas)
        {
            //Sensitivity
            if (Input.GetKey(KeyCode.Alpha1))
            {
                Divide += 50;
            }
            else if (Input.GetKey(KeyCode.Alpha2))
            {
                Divide -= 50;
            }
        }
        else
        {
            if (Input.GetKey(KeyCode.Alpha1))
            {
                Divide += 10;
            }
            else if (Input.GetKey(KeyCode.Alpha2))
            {
                Divide -= 10;
            }
        }
        //Divide = Mathf.Clamp(Divide,10, 1000);

        if (!OnDeltas)
        {
            position = msg.LoadPositions();

            Vector3 newPos = new Vector3(position.x / Divide, position.y / Divide, -position.z / Divide);
            newPos = new Vector3(Mathf.Clamp(newPos.x, minMaxX.x, minMaxX.y),
                                 Mathf.Clamp(newPos.y, minMaxY.x, minMaxY.y),
                                 Mathf.Clamp(newPos.z, minMaxZ.x, minMaxZ.y));
            this.transform.position = newPos;
            //this.GetComponent<Rigidbody>().position = newPos;
        }
        else
        {
            position = msg.LoadPositions();
            deltas   = msg.LoadDeltas();

            float eps = 2;
            if (deltas.x >= -eps && deltas.x <= eps)
            {
                deltas.x = 0;
            }
            if (deltas.y >= -eps && deltas.y <= eps)
            {
                deltas.y = 0;
            }
            if (deltas.z >= -eps && deltas.z <= eps)
            {
                deltas.z = 0;
            }

            Vector3 newPos = new Vector3(transform.position.x + (deltas.x / Divide), transform.position.y + (deltas.y / Divide), transform.position.z - (deltas.z / Divide));
            newPos = new Vector3(Mathf.Clamp(newPos.x, minMaxX.x, minMaxX.y),
                                 Mathf.Clamp(newPos.y, minMaxY.x, minMaxY.y),
                                 Mathf.Clamp(newPos.z, minMaxZ.x, minMaxZ.y));
            this.transform.position = newPos;
        }
        lastWriting = msg.IsWritingPen();
    }
Ejemplo n.º 8
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;
            }
        }
    }
Ejemplo n.º 9
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();
                }
            }
        }
    }