Exemplo n.º 1
0
        private void DrawConnection()
        {
            var     fromPoint = RootView.ToWindowPosition(Task.Position + new Vector2(0, -EditorConfiguration.NodeSize.y / 2 + EditorConfiguration.TaskNodeConnectionPadding));
            Vector2 toPoint;

            if (Task.ParentTask == null)
            {
                toPoint = EditorConfiguration.BehaviorTreeNodePosition + new Vector2(0, EditorConfiguration.NodeSize.y / 2 - EditorConfiguration.TaskNodeConnectionPadding);
            }
            else
            {
                var parentNodeId = string.Format("{0}-Node", Task.ParentTask.Id);
                var parentNode   = RootView.Children.Find(n => n.Id == parentNodeId) as TaskNode;

                toPoint = parentNode.Task.Position + new Vector2(0, EditorConfiguration.NodeSize.y / 2 - EditorConfiguration.TaskNodeConnectionPadding);
            }

            toPoint = RootView.ToWindowPosition(toPoint);

            Handles.DrawBezier(fromPoint
                               , toPoint
                               , fromPoint - Vector2.up * EditorConfiguration.TaskNodeConnectionTangent
                               , toPoint - Vector2.down * EditorConfiguration.TaskNodeConnectionTangent
                               , EditorConfiguration.TaskNodeConnectionColor
                               , null
                               , EditorConfiguration.TaskNodeConnectionLineWidth);
        }
Exemplo n.º 2
0
 protected override Rect CalculateGUIRect()
 {
     return(new Rect(RootView.ToWindowPosition(EditorConfiguration.BehaviorTreeNodePosition - EditorConfiguration.NodeSize / 2), EditorConfiguration.NodeSize));
 }