示例#1
0
        // Clone
        public Sequence Clone()
        {
            Sequence r = new Sequence(0);

            r.name       = name;
            r.info       = info;
            r.numEntries = numEntries;

            for (int i = 0; i < entries.Count; i++)
            {
                SequenceEntry e = (SequenceEntry)entries[i];
                r.entries.Add(e.Clone());
            }
            return(r);
        }
示例#2
0
    /// <summary>
    /// Updates the playback.
    /// </summary>
    /// <returns><c>true</c>, if playback was updated, <c>false</c> otherwise.</returns>
    /// <param name="entries">Entries.</param>
    public bool UpdatePlayback(ref ArrayList entries)
    {
        // We are not playing any more
        if (IsPlaying() != true)
        {
            return(false);
        }

        Sequence seq = (Sequence)sequences[currentSequence];

        // Make sure to stop playing current sequence when we have hit the end
        if (currentSequenceEntry >= seq.entries.Count)
        {
            currentSequence      = ovrLipSyncContextSequencerValues.CurrentSequenceNotSet;
            currentSequenceEntry = 0;
            return(false);
        }

        float currentTime = Time.time - startTime;

        SequenceEntry e         = (SequenceEntry)seq.entries[currentSequenceEntry];
        float         entryTime = e.timestamp;

        while (currentTime > entryTime)
        {
            // Do not add a null action, this is to inject 'NOP' values into the
            // stream
            if (e.action != ovrLipSyncContextSequencerValues.NullEntry)
            {
                entries.Add(e.Clone());
            }

            currentSequenceEntry++;

            if (currentSequenceEntry >= seq.entries.Count)
            {
                currentSequence = -1;
                return(false);
            }

            // Keep filling entries with valid entries
            e         = (SequenceEntry)seq.entries[currentSequenceEntry];
            entryTime = e.timestamp;
        }

        return(true);
    }
示例#3
0
    /// <summary>
    /// Adds the entry to recording.
    /// </summary>
    /// <returns><c>true</c>, if entry to recording was added, <c>false</c> otherwise.</returns>
    /// <param name="entry">Entry.</param>
    public bool AddEntryToRecording(ref SequenceEntry entry)
    {
        if (recording == false)
        {
            return(false);
        }

        SequenceEntry newEntry = entry.Clone();

        // set the timestamp
        newEntry.timestamp = Time.time - startTime;

        recordingSequence.entries.Add(newEntry);
        recordingSequence.numEntries++;

        return(true);
    }