Ejemplo n.º 1
0
        void Update()
        {
            if (!kinectManager || !saverPlayer || sensorData == null)
            {
                return;
            }

            // check if the body-data is playing
            bool bPlayerActive = saverPlayer.IsPlaying();

            // check for users while playing
            if (sensorData.trackedBodiesCount > 0)
            {
                lastUserTime = Time.realtimeSinceStartup;
            }

            bool bUserFound = (Time.realtimeSinceStartup - lastUserTime) < userLostMaxTime;

            if (!bPlayerActive && !bUserFound)
            {
                saverPlayer.StartPlaying();
            }
            else if (bPlayerActive && bUserFound)
            {
                saverPlayer.StopRecordingOrPlaying();
                kinectManager.ClearKinectUsers();
            }
        }
        void Update()
        {
            if (!saverPlayer || !kinectManager || !kinectManager.IsInitialized())
            {
                return;
            }

            if (isRecording && !saverPlayer.IsRecording())
            {
                // recording stopped
                isRecording = false;

                if (recIcon)
                {
                    recIcon.gameObject.SetActive(false);
                }
            }

            if (isPlaying && !saverPlayer.IsPlaying())
            {
                // playing stopped
                isPlaying = false;

                if (playIcon)
                {
                    playIcon.gameObject.SetActive(false);
                }
            }

            // Jump-key (Space) - start or stop recording
            if (Input.GetButtonDown("Jump") && !isPlaying && !isCountingDown)
            {
                isCountingDown = true;
                StartCoroutine(CountdownAndStartRecording());
            }

            // Fire1-key (Ctrl) - start or stop playing
            if (Input.GetButtonDown("Fire1") && !isRecording && !isCountingDown)
            {
                StartOrStopPlaying();
            }
        }