Beispiel #1
0
 public void OnBezierZoneEvent(BezierZoneEvent bEvent)
 {
     Debug.Log(string.Format("{0}, {1}, {2}", bEvent.point.CurveTime, bEvent.type, bEvent.zone));
     if (bEvent.type == forkCondition.type && bEvent.zone == forkCondition.zone)
     {
         if (externalCondtion == null || externalCondtion())
         {
             if (forkCondition.point == null || forkCondition.point == bEvent.point)
             {
                 Debug.Log(string.Format(
                               "Attatch {0} from {1} to {2} at {3} time",
                               bEvent.point, bEvent.point.Curve, fork, forkAttachTime
                               ));
                 bEvent.point.Attach(fork, forkAttachTime);
             }
         }
     }
 }
Beispiel #2
0
    public void OnBezierZoneEvent(BezierZoneEvent bEvent)
    {
        if (bEvent.zone == this)
        {
            for (int i = 0, l = forwardEventsTo.Length; i < l; i++)
            {
                MonoBehaviour component = forwardEventsTo[i];
                if (component == null)
                {
                    Debug.LogWarning(this + ": Missing target for zone/null");
                    continue;
                }
                var type       = component.GetType();
                var methodInfo = type.GetMethod("OnBezierZoneEvent");
                if (methodInfo == null)
                {
                    Debug.LogWarning(component + " is missing OnBezierZoneEvent");
                }
                else
                {
                    methodInfo.Invoke(component, new object[] { bEvent });
                }

                /*
                 * if (forwardEventsTo[i].gameObject == gameObject)
                 * {
                 *  Debug.LogWarning(
                 *      string.Format(
                 *          "Zone {0} and behaviour {1} is on same game object, no need to forward",
                 *          this, forwardEventsTo[i]));
                 * } else
                 * {
                 *  forwardEventsTo[i].SendMessage("OnBezierZoneEvent", bEvent);
                 * }
                 */
            }
        }
    }