コード例 #1
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);
        }
    }