Exemplo n.º 1
0
    private void FixedUpdate()
    {
        //checkMicrophone();

        if (!leap_controller.IsConnected)
        {
            return;
        }

        leap_frame = leap_controller.Frame();
        leap_hands = leap_frame.Hands;
        //Debug.Log(leap_controller);
        //Debug.Log("Hand Count: " + leap_hands.Count);

        //Debug.Log(leap_leftHandPos.z);
        //Debug.Log(leap_rightHandPos.z);

        if (!_isStarted && leap_hands.Count == 0)
        {
            startMenu.noHandDetected();
        }
        else if (!_isStarted && leap_hands.Count == 1)
        {
            startMenu.oneHandDetected(leap_hands[0]);
        }
        else if (!_isStarted && leap_hands.Count == 2)
        {
            startMenu.twoHandsDetected(Time.deltaTime);
        }

        if (_isStartingProcedure)
        {
            updateHandPositions();
            player._update();
        }

        if (_isStarted)
        {
            if (checkLeftSensorArea())
            {
                return;
            }

            updateHandPositions();
            player._update();
            checkGestures();
            checkLeavingSensorArea();
            checkMicrophone();

            survivedTime   += Time.deltaTime;
            currTimePeriod += Time.deltaTime;

            if (survivedTime < 10f)
            {
                if (currTimePeriod > 2f)
                {
                    doLevel_01();

                    timePeriodCount++;
                    currTimePeriod = 0;
                }
            }
            else if (survivedTime < 20f)
            {
                if (currTimePeriod > 1.3f)
                {
                    doLevel_01();

                    timePeriodCount++;
                    currTimePeriod = 0;
                }
            }
            else if (survivedTime < 30f)
            {
                if (currTimePeriod > 0.8f)
                {
                    doLevel_01();

                    timePeriodCount++;
                    currTimePeriod = 0;
                }
            }
            else
            {
                levelText.updateText("Level 02");
            }



            timeText.updateText_Time(survivedTime);
        }
    }