Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     FalconUnity.getFalconButtonStates(0, out botones);
     if (botones[1] == true)
     {
         contador.b_instanciar = 0;
         contador.bodynum      = 1;
     }
 }
Exemplo n.º 2
0
 private void Update()
 {
     if (!this.falcon)
     {
         return;
     }
     this.falconPos = this.falcon.transform.localPosition;
     FalconUnity.getFalconButtonStates(0, out this.buttons);
     this.cursor.transform.localPosition = new Vector3(this.falconPos.x * 0.21333f * this.sensitivity, this.falconPos.y * 0.12f * this.sensitivity, 0.418f);
 }
 public void Update()
 {
     if (falcon)
     {
         FalconUnity.getFalconButtonStates(0, out this.buttons); // Which buttons are currently pressed?
         if (!prevClick && (this.buttons[3] || buttons[1]))
         {
             Process();
             eventListener.OnPointerClick(GetFalconEventData());
         }
         prevClick = (this.buttons[3] || buttons[1]);
     }
 }
Exemplo n.º 4
0
    private void Update()
    {
        if (!this.falcon) // Not using the contoller, so mouse is fine
        {
            if (Input.mouseScrollDelta.y != 0f)
            {
                this.zoom += Mathf.Sign(Input.mouseScrollDelta.y) * 0.1f;
            }
            // Enforce a boundary on the zoom
            this.zoom = Mathf.Max(Mathf.Min(0.8f, this.zoom), 0f);

            // The new camera rotation will depend on the movement of the mouse
            this.nextpos  = new Vector3(base.transform.localEulerAngles.x - Input.mousePosition.y + this.mousepos.y, base.transform.localEulerAngles.y + Input.mousePosition.x - this.mousepos.x, 0f);
            this.mousepos = Input.mousePosition;
        }
        else                                                        // Using the controller
        {
            FalconUnity.getFalconButtonStates(0, out this.buttons); // Which buttons are currently pressed?
            //Set the new position based on the movement of the controller
            Vector3 cursorPosition = state.getCursorPosition();

            float newX = transform.localEulerAngles.x - (cursorPosition.y - cameraBounds.center.y) / 1000 * this.sensitivity;
            float newY = transform.localEulerAngles.y + (cursorPosition.x - cameraBounds.center.x) / 1000 * this.sensitivity;
            this.nextpos = new Vector3(newX, newY, 0f);
        }

        // Update the zoom
        this.cam.transform.localPosition = new Vector3(this.cam.transform.localPosition.x, this.cam.transform.localPosition.y, this.zoom);

        // Enforce a boundary on rotating up/down
        if (this.nextpos.x > 270f && this.nextpos.x < 280f)
        {
            this.nextpos.x = 280f;
        }
        else if (this.nextpos.x > 35f && this.nextpos.x < 90f)
        {
            this.nextpos.x = 35f;
        }

        // If the pan button is pressed (right click on mouse, or left button on controller), update the camera rotations
        if ((this.falcon && this.buttons[0]) || Input.GetMouseButton(1))
        {
            base.transform.localEulerAngles = this.nextpos;
            this.panning = true;
        }
        else
        {
            this.panning = false;
        }
    }
Exemplo n.º 5
0
 private void Update()
 {
     buttons = 0;
     if (this.falcon) // Update the cursor position every frame
     {
         this.cursorPosition = falconCamera.WorldToScreenPoint(this.falconCursor.transform.position);
         FalconUnity.getFalconButtonStates(0, out falconButtons);
         buttons |= falconButtons[0] ? 1 : 0; // middle button
         buttons |= falconButtons[1] ? 2 : 0; // left button
         buttons |= falconButtons[2] ? 4 : 0; // top button
         buttons |= falconButtons[3] ? 2 : 0; // right button
     }
     else
     {
         this.cursorPosition = Input.mousePosition;
         buttons            |= Input.GetMouseButton(1) ? 1 : 0; // right mouse button
         buttons            |= Input.GetMouseButton(0) ? 2 : 0; // left mouse button
     }
 }
Exemplo n.º 6
0
    void LateUpdate()
    {
        bool res = FalconUnity.getFalconButtonStates(falcon_num, out curr_buttons);


        if (!res)
        {
            //			Debug.Log("Error getting button states");
            return;
        }
        //go through the buttons, seeing which are pressed
        for (int i = 0; i < 4; i++)
        {
            if (button_states[i] && button_states[i] != curr_buttons[i])
            {
                buttonPressed(i);
            }

            button_states[i] = curr_buttons[i];
        }
    }
Exemplo n.º 7
0
    public void Update()
    {
        bool       res1 = FalconUnity.getFalconButtonStates(0, out botones);
        Vector3    pos;
        Quaternion orient;

        if (contador.bodynum == 0)

        {
            if (gameObject.tag == "cubo_peque" || gameObject.tag == "cilindro_peque" || gameObject.tag == "octa_peque")
            {
                bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
                if (!res)
                {
                    //			Debug.Log("Error getting object pose");
                    return;
                }
                transform.localPosition = pos;
                transform.localRotation = orient;
                FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
            }
        }
        if (gameObject.tag == "cubo_peque" || gameObject.tag == "cilindro_peque" || gameObject.tag == "octa_peque")
        {
            if (botones[1] == true)
            {
                if (contador.saber == 1 && contador.mensaje == 0)
                {
                    Debug.Log("como lo hace");
                    //FalconUnity.removeDynamicShape(bodyId);

                    bool res4 = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
                    transform.localPosition = pos;
                    transform.localRotation = orient;
                    GameObject nuevo = Instantiate(cubo, new Vector3(pos.x, pos.y - 1.5f, pos.z), cubo.transform.rotation);
                    nuevo.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
                    // FalconUnity.setDynamicShapePose(bodyId, new Vector3(pos.x, pos.y - 1f, pos.z), orient);
                    // FalconUnity.applyForceToShape(bodyId, new Vector3(0, -23, 0), new Vector3(0, 0, 0));
                    //                GetComponent<Rigidbody>().useGravity = true;
                    //Destroy(gameObject);

                    // Destroy(gameObject);
                    // Instantiate(donita1, new Vector3(pos.x, pos.y - 0.8f, pos.z), orient);
                    // gameObject.AddComponent<Rigidbody>(); // Add the rigidbody.
                    contador.saber = 0;
                    FalconUnity.removeDynamicShape(bodyId);
                    Destroy(gameObject);
                }
            }


            // contador.bodynum = 0;
            if (contador.saber == 0)
            {
                FalconUnity.applyForceToShape(bodyId, new Vector3(0, -1.5f, 0), new Vector3(0, 0, 0));
            }
            if (contador.borrar == 1 || contador.ganador_consultorio == 1)
            {
                FalconUnity.removeDynamicShape(bodyId);
                contador.borrar = 0;
                Destroy(gameObject);
            }
        }
        else
        {
            bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
            if (!res)
            {
                //			Debug.Log("Error getting object pose");
                return;
            }
            transform.localPosition = pos;
            transform.localRotation = orient;
            FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
        }
    }