Advertisement
napland

Untitled

Nov 12th, 2018
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1.         List<float[]> points = new List<float[]>();
  2.         float timeNow; // this should be Time.RealTimeSinceStartup;
  3.         float timeFrame = 8;
  4.        
  5.         void OnButtonPressed()
  6.         {
  7.             if (points.Count == 0)
  8.             {
  9.                 // jump from start to 4 seconds before NOW
  10.                 points.Add(new float[] { 0, timeNow - 0.5f * timeFrame});
  11.  
  12.                 // placeholder for the next jump, we know the start, but not the end yet
  13.                 points.Add(new float[] { timeNow + 0.5f * timeFrame, float.NegativeInfinity });
  14.             }
  15.             else
  16.             {
  17.                 float lastJumpStart = points[points.Count - 1][0];
  18.                 float lastJumpEndNew = timeNow - 0.5f * timeFrame;
  19.                 float lastJumpEndCurrent = points[points.Count - 1][1];
  20.                 if (lastJumpEndNew < lastJumpEndCurrent)
  21.                 {
  22.                     points[points.Count - 1][1] = lastJumpEndNew;
  23.                 }
  24.                 else
  25.                 {
  26.                     points[points.Count - 1][1] = lastJumpEndNew;
  27.                     points.Add(new float[] { timeNow + 0.5f * timeFrame, float.NegativeInfinity });
  28.                 }
  29.             }
  30.         }
  31.  
  32.         void ProcessMarks()
  33.         {
  34.             for (int i = 0; i < points.Count; i++)
  35.             {
  36.                 if (i == points.Count - 1) // last index need to modify the end of the jump to the end of the video Length
  37.                 {
  38.                     points[i][1] = timeNow;
  39.                 }
  40.  
  41.                 // just add marks directly to the Intellimark object
  42.             }
  43.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement