コード例 #1
0
    private void Update()
    {
        timeElaspedSinceRecordingFound += Time.deltaTime;
        if (detectedRecording != null)
        {
            for (int i = detectedRecordingFrameIndex; i < detectedRecording.recordedStates.Count - 1; ++i)
            {
                if (detectedRecording.Compare(detectedRecordingFrameIndex, head, leftHand, rightHand))
                {
                    detectedRecordingFrameIndex++;
                }
                else if (timeElaspedSinceRecordingFound < detectedRecording.recordedStates[detectedRecordingFrameIndex].stateTime)
                {
                    break;
                }
                else
                {
                    detectedRecording.UnhighlightProgress();
                    detectedRecordingFrameIndex = 0;
                    detectedRecording           = null;
                    break;
                }
            }

            if (detectedRecording != null)
            {
                // Check if the found recording is ready to be completed
                if (detectedRecordingFrameIndex >= detectedRecording.recordedStates.Count - 1)
                {
                    detectedRecording.UnhighlightProgress();
                    detectedRecording.action.Play();
                    detectedRecording.completions++;
                    RecordingUI.inst.showRecordingDetails();
                    timeRemaining = timeBetweenActions;
                    detectedRecordingFrameIndex = 0;
                    detectedRecording           = null;
                }
            }
        }
        else
        {
            if (timeRemaining <= 0)
            {
                foreach (Recording recording in recordings)
                {
                    if (recording.capturingEnded)
                    {
                        if (recording.Compare(0, head, leftHand, rightHand))
                        {
                            detectedRecording = recording;
                            timeElaspedSinceRecordingFound = 0;
                        }
                    }
                }
            }
        }
        if (timeRemaining > 0)
        {
            timeRemaining -= Time.deltaTime;
        }
    }