Example #1
0
 protected void onEventOccuring(timelineEvent occuringNow)
 {
     if (eventOccuring != null)
     {
         eventOccuring.Invoke((timeline)this, occuringNow);
     }
 }
Example #2
0
 public override void Awake()
 {
     base.Awake();
     canBeDeleted      = true;
     _timelineEvent    = GetComponentInParent <timelineEvent>();
     timelineTransform = _timelineEvent.transform.parent;
     createHandleFeedback();
 }
    bool isOverlap(timelineEvent tlA, timelineEvent tlB)
    {
        if (tlA.track != tlB.track)
        {
            return(false);
        }

        Vector2 a  = tlA.in_out;
        Vector2 b  = tlB.in_out;
        bool    c1 = a.x <= b.x && a.y >= b.x;
        bool    c2 = b.x <= a.x && b.y >= a.x;

        return(c1 || c2);
    }
 public void overlapCheck(timelineEvent e)
 {
     for (int i = _tlEvents.Count - 1; i >= 0; i--)
     {
         if (e != _tlEvents[i])
         {
             if (isOverlap(_tlEvents[i], e))
             {
                 if (isInside(_tlEvents[i].in_out, e.in_out))
                 {
                     if (_tlEvents[i].playing)
                     {
                         tlEventTrigger(i, false);
                     }
                     _tlEvents[i].pleaseDestroy = true;
                     _tlEvents.RemoveAt(i);
                 }
                 else if (isInside(e.in_out, _tlEvents[i].in_out))
                 {
                     Vector2 a = new Vector2(e.in_out.y + .01f, _tlEvents[i].in_out.y);
                     _tlEvents[i].setOut(e.in_out.x - .01f);
                     lock (_spawnLock) {
                         toSpawn[_tlEvents[i].track] = a;
                     }
                 }
                 else if (e.in_out.x < _tlEvents[i].in_out.x)
                 {
                     _tlEvents[i].setIn(e.in_out.y + .01f);
                 }
                 else
                 {
                     _tlEvents[i].setOut(e.in_out.x - .01f);
                 }
             }
         }
     }
 }