// counts down (from 3 for instance), then starts recording
        private IEnumerator CountdownAndStartRecording()
        {
            // count down
            if (!isRecording && countdown != null && countdown.Length > 0)
            {
                for (int i = 0; i < countdown.Length; i++)
                {
                    if (countdown[i])
                    {
                        countdown[i].gameObject.SetActive(true);
                    }

                    yield return(new WaitForSeconds(1f));

                    if (countdown[i])
                    {
                        countdown[i].gameObject.SetActive(false);
                    }
                }
            }

            isCountingDown = false;

            if (saverPlayer)
            {
                if (!isRecording)
                {
                    // start recording
                    isRecording = true;

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

                    saverPlayer.StartRecording();
                }
                else
                {
                    // stop recording
                    isRecording = false;

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

                    saverPlayer.StopRecordingOrPlaying();
                }
            }
        }
Exemple #2
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();
            }
        }