private static void DrawNode(Node node, bool selected, Texture2D iconImage, int boxColor) { float sharedHeight = node.position.yMin + 15; DrawDecorators(node, ref sharedHeight); Rect insideMainNode = node.position; insideMainNode.xMin += 7; insideMainNode.xMax -= 7; insideMainNode.yMin = sharedHeight; insideMainNode.yMax = sharedHeight + 32 + GetCommentHeight(node.comment); GUIStyle insideMainNodeStyle = BehaviorTreesEditorStyles.GetNodeStyle(boxColor, false); if (EditorApplication.isPlaying) { if (node is Task) { Task t = node as Task; insideMainNodeStyle = BehaviorTreesEditorStyles.GetNodeStyle( BehaviorTreesEditor.CheckThisTaskClosed(t) ? (int)NodeColor.Yellow : boxColor, BehaviorTreesEditor.CheckThisTaskClosed(t)); } } GUI.Box(insideMainNode, "", insideMainNodeStyle); int?myIndex = BehaviorTreesEditorUtility.GetMyIndex(node); if (myIndex != null && circleIcon != null) { float circleIconWidth = circleIcon.width * 1.1f; float circleIconHeight = circleIcon.height * 1.1f; Rect indexRect = new Rect(insideMainNode.xMax - circleIconWidth / 2f + 12, insideMainNode.yMin - circleIconHeight / 2f, circleIconWidth, circleIconHeight); GUI.DrawTexture(indexRect, circleIcon); indexRect.xMin -= 2; indexRect.yMin -= 2; GUI.Label(indexRect, "<color=black>" + (myIndex + 1).ToString() + "</color>", BehaviorTreesEditorStyles.nodeIndexLabel); } Rect iconRect = node.position; iconRect.x = node.position.xMin + 7; iconRect.y = sharedHeight - 1; GUI.Label(iconRect, iconImage); Rect nameRect = node.position; nameRect.x = node.position.xMin + 42; nameRect.y = sharedHeight + 5; GUI.Label(nameRect, "<color=white>" + node.Name + "</color>", BehaviorTreesEditorStyles.nodeBoxNameNormalStyle); GUIContent commentContent = new GUIContent(node.comment); Rect commentRect = node.position; commentRect.x = node.position.xMin + 7; commentRect.y = sharedHeight + 30; commentRect.width = BehaviorTreesEditorStyles.nodeBoxCommentStyle.CalcSize(commentContent).x + 10; GUI.Label(commentRect, "<color=white>" + node.comment + "</color>", BehaviorTreesEditorStyles.nodeBoxCommentStyle); sharedHeight += insideMainNode.yMax - insideMainNode.yMin + 5; DrawServices(node, sharedHeight); }