IsKinectInitialized() public static method

public static IsKinectInitialized ( ) : bool
return bool
Ejemplo n.º 1
0
 private void Update()
 {
     if (!KinectManager.IsKinectInitialized())
     {
         return;
     }
 }
Ejemplo n.º 2
0
    void Update()
    {
        //Vaisseau.avancer();

        this.gameObject.transform.Translate(Vector3.back * speed * Time.deltaTime);

        j++;

        if (manager != null && KinectManager.IsKinectInitialized() && manager.GetPlayer1ID() > 0)
        {
            uint    userId          = manager.GetPlayer1ID();
            Vector3 screenNormalPos = Vector3.zero;


            if (manager.GetGestureProgress(userId, KinectWrapper.Gestures.TournerADroite) >= 0.1f)
            {
                this.gameObject.transform.Rotate(Vector3.up * 1.5f, Space.World);
            }

            if (manager.GetGestureProgress(userId, KinectWrapper.Gestures.TournerAGauche) >= 0.1f)
            {
                this.gameObject.transform.Rotate(Vector3.down * 1.5f, Space.World);
            }            //*/

            if (manager.GetGestureProgress(userId, KinectWrapper.Gestures.Accelerer) >= 0.1f)
            {
                if (!fast)
                {
                    fast   = true;
                    speed *= 5;
                }
            }            //*/

            else if (manager.GetGestureProgress(userId, KinectWrapper.Gestures.Ralentir) <= 0.1f)
            {
                if (fast)
                {
                    fast   = false;
                    speed /= 5;
                }
            }            //*/

            if (manager.GetGestureProgress(userId, KinectWrapper.Gestures.TirDroite) >= 0.1f)
            {
                if ((j % 10) == 0)
                {
                    canonDroite.GetComponent <CanonJoueur>().shoot = true;
                }
            }            //*/


            if (manager.GetGestureProgress(userId, KinectWrapper.Gestures.TirGauche) >= 0.1f)
            {
                if ((j % 10) == 0)
                {
                    canonGauche.GetComponent <CanonJoueur>().shoot = true;
                }
            }            //*/
        }
    }
Ejemplo n.º 3
0
    IEnumerator CountDown()
    {
        //Debug.Log(KinectManager.aux);
        //yield return new WaitUntil(KinectManager.aux.iniciar = true);
        if (KinectManager.IsKinectInitialized())
        {
            System.Func <bool> playerDetected = new System.Func <bool>(KinectManager.Instance.IsUserDetected);
            yield return(new WaitUntil(playerDetected));
        }
        yield return(new WaitForSeconds(1));

        levelText.text = "3";
        yield return(new WaitForSeconds(1));

        levelText.text = "2";
        yield return(new WaitForSeconds(1));

        levelText.text = "1";
        yield return(new WaitForSeconds(1));

        levelText.text = "Vá!";
        yield return(new WaitForSeconds(1));

        levelText.text = "";

        playersTurn = true;
    }
Ejemplo n.º 4
0
    void Update()
    {
        KinectManager manager = KinectManager.Instance;

        if (!levelLoaded && manager && KinectManager.IsKinectInitialized())
        {
            levelLoaded = true;
        }
    }
Ejemplo n.º 5
0
    void Update()
    {
        KinectManager manager = KinectManager.Instance;

        if (!levelLoaded && manager && KinectManager.IsKinectInitialized())
        {
            levelLoaded = true;
            Application.LoadLevel(1);
        }
    }
Ejemplo n.º 6
0
    void Update()
    {
        KinectManager manager = KinectManager.Instance;

        if (!levelLoaded && manager && KinectManager.IsKinectInitialized())
        {
            levelLoaded = true;
            SceneManager.LoadScene("Cargarmodelo1");
        }
    }
Ejemplo n.º 7
0
    void OnGUI()
    {
        if (infoGUI != null && manager != null && KinectManager.IsKinectInitialized())
        {
            string sInfo = string.Empty;

            uint userID = manager.GetPlayer1ID();
            if (userID != 0)
            {
                if (manager.GetGestureProgress(userID, KinectWrapper.Gestures.Accelerer) >= 0.1f)
                {
                    //sInfo += "Geste : Accelerer\n";
                    sInfo += speed + "\n";
                }

                if (manager.GetGestureProgress(userID, KinectWrapper.Gestures.Ralentir) >= 0.1f)
                {
                    sInfo = "Geste : Ralentir\n";
                }

                if ((manager.GetGestureProgress(userID, KinectWrapper.Gestures.TirDroite) >= 0.1f) &&
                    (manager.GetGestureProgress(userID, KinectWrapper.Gestures.TirGauche) >= 0.1f)
                    )
                {
                    sInfo = "Geste : Tir droite et gauche\n";
                }
                else if (manager.GetGestureProgress(userID, KinectWrapper.Gestures.TirDroite) >= 0.1f)
                {
                    sInfo = "Geste : Tir droite\n";
                }
                else if (manager.GetGestureProgress(userID, KinectWrapper.Gestures.TirGauche) >= 0.1f)
                {
                    sInfo = "Geste : Tir gauche\n";
                }

                if (manager.GetGestureProgress(userID, KinectWrapper.Gestures.TournerADroite) >= 0.1f)
                {
                    sInfo = "Geste : Rotation droite\n";
                }

                if (manager.GetGestureProgress(userID, KinectWrapper.Gestures.TournerAGauche) >= 0.1f)
                {
                    sInfo = "Geste : Rotation gauche\n";
                }
            }
            else
            {
                sInfo = "Waiting for Users...";
            }

            infoGUI.guiText.text = sInfo;
        }
    }
Ejemplo n.º 8
0
    void Update()
    {
        if (validateKinectManager)
        {
            KinectManager manager = KinectManager.Instance;

            if (!levelLoaded && manager && KinectManager.IsKinectInitialized())
            {
                if (Input.GetKeyUp(KeyCode.Alpha1))
                {
                    levelLoaded = true;
                    SceneManager.LoadScene(1);
                }
            }
        }
    }
Ejemplo n.º 9
0
    void updateData()
    {
        if (KinectManager.IsKinectInitialized())
        {
            if (KinectManager.Instance.IsUserDetected())
            {
                //xHead = cManController.Shoulder_Center.transform.position.x;
                //yHead = cManController.Shoulder_Center.transform.position.y;
                //xCenter = cManController.Hip_Center.transform.position.x;
                //yCenter = cManController.Hip_Center.transform.position.y;

                Vector3 head   = new Vector3(cManController.Shoulder_Center.transform.position.x, cManController.Shoulder_Center.transform.position.y);
                Vector3 center = new Vector3(cManController.Hip_Center.transform.position.x, cManController.Hip_Center.transform.position.y);

                getAngleSpine(head, center);
                Debug.Log(getAngleSpine(head, center));
                //getAngulo();
                parametros.Add(new Dado()
                {
                    id = 4, valor = "" + angulo, timestamp = (long)(System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1))).TotalMilliseconds
                });
                parametros.Add(new Dado()
                {
                    id = 5, valor = "" + distZ, timestamp = (long)(System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1))).TotalMilliseconds
                });
                parametros.Add(new Dado()
                {
                    id = 6, valor = "" + distX, timestamp = (long)(System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1))).TotalMilliseconds
                });
                parametros.Add(new Dado()
                {
                    id = 7, valor = "" + ponto, timestamp = (long)(System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1))).TotalMilliseconds
                });
                //print(ponto);
                //Debug.Log(angulo);
            }
        }
    }
Ejemplo n.º 10
0
    //初始化设备
    public bool InitDevice()
    {
        // Get the KinectManager instance
        if (kinectManager == null)
        {
            kinectManager = KinectManager.Instance;
        }

        if (gloveManager == null)
        {
            gloveManager = DTGloveManager.instance;
        }

        if (lpSensorManager == null)
        {
            lpSensorManager = new LpSensorManager(ref test_data, ref cur_ModelCtrlData.wristCtrlData, 23333, "00:04:3E:9E:00:C5", 20);

            if (lpSensorManager.Init())
            {
                lpThread = new Thread(new ThreadStart(lpSensorManager.receiveData));
                lpThread.Start();
            }
        }

        if (!KinectManager.IsKinectInitialized())
        {
            Debug.Log("Kinect 未初始化");
            return(false);
        }
        if (!DTGloveManager.instance.glove.IsOpen())
        {
            Debug.Log("5DT 未初始化");
            return(false);
        }

        return(true);
    }
Ejemplo n.º 11
0
    // Update is called once per frame
    void Update()
    {
        //Camera
        if (Input.GetKeyDown(KeyCode.C))
        {
            cam1.enabled = !cam1.enabled;
            cam2.enabled = !cam2.enabled;
        }

        //----------MODIFICACOES------------//
        if (count == false)
        {
            startTime = Time.time;
        }
        //----------MODIFICACOES------------//

        if (!GameManager.instance.playersTurn)
        {
            return;
        }

        helice.transform.Rotate(0.0f, -flight_speed * 100 * Time.deltaTime, 0.0f);

        Vector3 rotation;

        if (KinectManager.IsKinectInitialized())
        {
            if (Interface.instance.yToggle)
            {
                float y        = center.transform.position.z - head.transform.position.z; //diferença de profundidade
                float movmenty = y * multiplicadorY;

                if (movmenty > turn_speed)
                {
                    moveVertical = -(turn_speed);
                }
                else if (movmenty < turn_speed * -1)
                {
                    moveVertical = -(turn_speed * -1);
                }
                else
                {
                    moveVertical = movmenty;
                }
                moveVertical = -movmenty;
            }
            else
            {
                x = head.transform.position.x - center.transform.position.x;
                //Debug.Log("X = " + x);
                float movmentx = x * multiplicadorX;
                if (movmentx > turn_speed)
                {
                    moveHorizontal = turn_speed;
                }
                else if (movmentx < turn_speed * -1)
                {
                    moveHorizontal = turn_speed * -1;
                }
                else
                {
                    moveHorizontal = movmentx;
                }
            }
        }
        else
        {
            //Debug.Log("test");
            moveHorizontal = turn_speed * Input.GetAxis("Horizontal");
            moveVertical   = -turn_speed *Input.GetAxis("Vertical");
        }
        float rotateVertical = -2 * moveVertical;

        if (Interface.instance.yToggle)
        {
            rotation       = new Vector3(5 * rotateVertical, moveVertical, 1.0f);
            moveHorizontal = 0f;
            //Debug.Log(rotation + "-" + moveVertical);
        }
        else
        {
            rotation     = new Vector3(1.0f, moveHorizontal, 5 * -moveHorizontal);
            moveVertical = 0f;
            //Debug.Log(rotation + "-" + moveHorizontal);
        }

        Vector3 movement = new Vector3(moveHorizontal, moveVertical, 0.0f) * Time.deltaTime;

        transform.Translate(flight_speed * Vector3.forward * Time.deltaTime, Space.World);
        transform.Translate(movement, Space.World);

        transform.localEulerAngles = rotation;                              // Aplicaçao da rotaçao sobre o modelo

        //Debug.Log(this.gameObject.transform.position.z - pos);
        //Debug.Log(GameManager.instance.erros);

        //-------------Modificações finais--------------//
        //xPlayerPosition = player.transform.position.x;
        //print(xPlayerPosition);

        //if(xPlayerPosition > -2.5f && xPlayerPosition < 2.5f)
        //{
        //    print(xPlayerPosition + "Faixa 2");
        //}
        //else if (xPlayerPosition > -7.5 && xPlayerPosition < -2.5f)
        //{
        //    print(xPlayerPosition + "Faixa 1");
        //}
        //else if (xPlayerPosition > 2.5f && xPlayerPosition < 7.5f)
        //{
        //    print(xPlayerPosition + "Faixa 3");
        //}

        //-------------Modificações finais--------------//
    }