// start or stop re-playing
        private void StartOrStopPlaying()
        {
            if (saverPlayer)
            {
                if (!isPlaying)
                {
                    // start playing
                    isPlaying = true;

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

                    saverPlayer.StartPlaying();
                }
                else
                {
                    // stop playing
                    isPlaying = false;

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

                    saverPlayer.StopRecordingOrPlaying();
                }
            }
        }
Пример #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();
            }
        }