/// <summary> 从GraphAssetOwner中加载 </summary> public static BaseGraphWindow LoadGraphFromAssetOwner(GraphAssetOwner _graphAssetOwner) { BaseGraphWindow graphWindow = LoadGraph(_graphAssetOwner.Graph); graphWindow.GraphAsset = _graphAssetOwner.GraphAsset; graphWindow.GraphView.Model.InitializePropertyMapping(_graphAssetOwner); graphWindow.GraphOwner = _graphAssetOwner; return(graphWindow); }
public override void DrawGizmos(GraphAssetOwner _graphOwner) { #if UNITY_EDITOR SharedGameObject variable = _graphOwner.GetVariable(center.GUID) as SharedGameObject; Gizmos.color = Color.green; if (variable != null && variable.Value != null) { Gizmos.DrawWireSphere(variable.Value.transform.position, range); Gizmos.DrawSphere(variable.Value.transform.position, 0.5f); } Gizmos.color = new Color(1, 0, 0, 0.3f); Gizmos.DrawMesh(SemicircleMesh(radius, (int)sector, Vector3.up), _graphOwner.transform.position + Vector3.up * 0.2f, _graphOwner.transform.rotation); #endif if (Application.isPlaying) { Gizmos.DrawSphere(targetPos, 0.5f); } }
public override void DrawGizmos(GraphAssetOwner _graphOwner) { #if UNITY_EDITOR if (waypoints == null) { return; } var oldColor = UnityEditor.Handles.color; UnityEditor.Handles.color = Color.yellow; for (int i = 0; i < waypoints.Value.Count; ++i) { if (waypoints.Value[i] != null) { UnityEditor.Handles.SphereHandleCap(0, waypoints.Value[i].transform.position, waypoints.Value[i].transform.rotation, 1, EventType.Repaint); } } UnityEditor.Handles.color = oldColor; #endif }
protected override void RegisterDrawers() { base.RegisterDrawers(); RegisterDrawer("serializedVariables", DrawSerialziedVaraibles); RegisterDrawer("variablesUnityReference", property => { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.PropertyField(property); EditorGUI.EndDisabledGroup(); }); RegisterDrawer("graphAsset", property => { EditorGUILayout.BeginHorizontal(); GraphAssetOwner owner = target as GraphAssetOwner; owner.GraphAsset = EditorGUILayout.ObjectField(graphContent, (target as GraphAssetOwner).GraphAsset, owner.GraphAssetType, false) as BaseGraphAsset; if (GUILayout.Button("Edit", GUILayout.Width(50))) { BaseGraphWindow.LoadGraphFromAssetOwner(target as GraphAssetOwner); } EditorGUILayout.EndHorizontal(); }); }