Exemplo n.º 1
0
    void SendEvent(BezierZone zone, BezierZoneEventType eventType)
    {
        MonoBehaviour component  = zone;
        var           type       = component.GetType();
        var           methodInfo = type.GetMethod("OnBezierZoneEvent");

        if (methodInfo == null)
        {
            Debug.LogWarning(zone + " is missing OnBezierZoneEvent");
        }
        else
        {
            //Debug.Log(eventType + ": " + this + " -> " + zone);
            methodInfo.Invoke(component, new object[] {
                new BezierZoneEvent(zone, this, eventType)
            });
        }
    }
Exemplo n.º 2
0
    protected void OnSceneGUI()
    {
        zone = target as BezierZone;
        if (zone.curve == null)
        {
            return;
        }

        //Handles.Label(zone.curve.GetPoint(zone.left), name);

        handleRotation = Tools.pivotRotation == PivotRotation.Local ?
                         zone.transform.rotation : Quaternion.identity;

        Handles.color = zone.lineColor;

        DrawHandle(0);
        DrawHandle(1);

        DrawCurve();
    }
Exemplo n.º 3
0
    void CheckEvents()
    {
        BezierZone.PointIsInZones(this, currentInZones);
        List <BezierZone> previousInZones = new List <BezierZone>();

        previousInZones.AddRange(inZones);
        inZones.Clear();

        for (int i = 0, l = previousInZones.Count; i < l; i++)
        {
            if (!currentInZones.Contains(previousInZones[i]))
            {
                SendEvent(previousInZones[i], BezierZoneEventType.ExitZone);
            }
        }

        for (int i = 0, l = currentInZones.Count; i < l; i++)
        {
            if (previousInZones.Contains(currentInZones[i]))
            {
                SendEvent(currentInZones[i], BezierZoneEventType.StayZone);
            }
            else
            {
                SendEvent(currentInZones[i], BezierZoneEventType.EnterZone);
            }
        }

        if (curveTime == 0 || curveTime == 1)
        {
            if (curve)
            {
                curve.SendMessage("OnBezierEnd", this, SendMessageOptions.DontRequireReceiver);
            }
            SendMessage("OnBezierEnd", this, SendMessageOptions.DontRequireReceiver);
        }

        inZones.AddRange(currentInZones);
    }
Exemplo n.º 4
0
 public BezierZoneEvent(BezierZone zone, BezierPoint point, BezierZoneEventType type)
 {
     this.zone  = zone;
     this.point = point;
     this.type  = type;
 }