public void SetSelections(FilterDelegate <BehaviourNode> select) { mSelection.Clear(); for (int i = 0; i < AIGraph.ElementCount; i++) { var node = AIGraph.GetElement <BehaviourNode>(i); if (node != null) { node.selected = select(node); if (node.selected) { mSelection.Add(node); } } } UpdateSelectionAssets(); if (mSelectionAssets.Count > 0) { Selection.objects = mSelectionAssets.ToArray(); } else if (mAssetBinder != null) { mAssetBinder.SelectTarget(); } }
public BehaviourNode GetRaycastNode(Vector2 globalPos) { for (int i = AIGraph.ElementCount - 1; i >= 0; i--) { var node = AIGraph.GetElement <BehaviourNode>(i); if (node != null && node.Visible && node.GlobalRect.Contains(globalPos)) { return(node); } } return(null); }
protected override void OnResized() { base.OnResized(); RaycastNode = GetRaycastNode(GlobalMousePosition); for (int i = 0; i < AIGraph.ElementCount; i++) { var bt = AIGraph.GetElement <BehaviourNode>(i); if (bt != null && !bt.cliped && bt != RaycastNode) { bt.DrawComment(false); } } }
public void EditNodes(System.Action <BehaviourNode> callback) { if (callback == null) { return; } for (int i = 0; i < AIGraph.ElementCount; i++) { var node = AIGraph.GetElement <BehaviourNode>(i); if (node != null) { callback(node); } } }