Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<float[]> points = new List<float[]>();
- float timeNow; // this should be Time.RealTimeSinceStartup;
- float timeFrame = 8;
- void OnButtonPressed()
- {
- if (points.Count == 0)
- {
- // jump from start to 4 seconds before NOW
- points.Add(new float[] { 0, timeNow - 0.5f * timeFrame});
- // placeholder for the next jump, we know the start, but not the end yet
- points.Add(new float[] { timeNow + 0.5f * timeFrame, float.NegativeInfinity });
- }
- else
- {
- float lastJumpStart = points[points.Count - 1][0];
- float lastJumpEndNew = timeNow - 0.5f * timeFrame;
- float lastJumpEndCurrent = points[points.Count - 1][1];
- if (lastJumpEndNew < lastJumpEndCurrent)
- {
- points[points.Count - 1][1] = lastJumpEndNew;
- }
- else
- {
- points[points.Count - 1][1] = lastJumpEndNew;
- points.Add(new float[] { timeNow + 0.5f * timeFrame, float.NegativeInfinity });
- }
- }
- }
- void ProcessMarks()
- {
- for (int i = 0; i < points.Count; i++)
- {
- if (i == points.Count - 1) // last index need to modify the end of the jump to the end of the video Length
- {
- points[i][1] = timeNow;
- }
- // just add marks directly to the Intellimark object
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement