Ejemplo n.º 1
0
 public void Init(DistanceReceiver receiver, float totalLength)
 {
     rcv          = receiver;
     length       = totalLength;
     titleContent = new GUIContent("Set Distance");
     minSize      = maxSize = new Vector2(240, 90);
 }
        protected void DistanceWindowMenu(Rect rect, DistanceReceiver receiver)
        {
            Vector2 mousePos = Event.current.mousePosition;

            if (Event.current.type == EventType.MouseDown && Event.current.button == 1 && rect.Contains(mousePos))
            {
                GenericMenu  menu   = new GenericMenu();
                SplineTracer tracer = (SplineTracer)target;
                menu.AddItem(new GUIContent("Set Distance"), false, delegate { DistanceWindow w = EditorWindow.GetWindow <DistanceWindow>(true); w.Init(tracer, receiver, tracer.CalculateLength()); });
                menu.ShowAsContext();
            }
        }