public override void OnInspectorGUI()
    {
        Handles.BeginGUI();
        GUI.enabled = !_isActive;
        if (GUILayout.Button("start"))
        {
            _isActive = true;
            _start    = _selected;
        }
        GUI.enabled = _isActive;
        if (GUILayout.Button("end"))
        {
            _isActive = false;
            _dest     = _selected;
            _route    = _start.GetRouteTo(_dest);
        }

        GUI.enabled = true;
        if (m_editMode)
        {
            if (GUILayout.Button("Disable Editing"))
            {
                EndEditMode();
            }
        }
        else if (GUILayout.Button("Enable Editing"))
        {
            StartEditMode();
        }


        Handles.EndGUI();
    }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     if (route == null || route.Destination != Destination)
     {
         WaypointNode closest = WaypointNode.GetClosest(transform.position);
         if (closest == null)
         {
             route = new WaypointRoute(this, Destination);
         }
         else
         {
             route = new WaypointRoute(this, closest.GetRouteTo(Destination));
         }
         route.NextWaypointReachedEvent  = NextWaypointReachedEvent;
         route.FinalWaypointReachedEvent = FinalWaypointReachedEvent;
     }
 }