public override bool AddChild(int outputIndex, BehaviorNodeWindow child) { if (outputIndex == 0 && conditionNode == null) { if (child.NodeType == BehaviorNodeType.Condition) { conditionNode = child; conditionNode.Parent = this; return(true); } return(false); } if (outputIndex == 1 && successNode == null) { successNode = child; successNode.Parent = this; return(true); } if (outputIndex == 2 && failureNode == null) { failureNode = child; failureNode.Parent = this; return(true); } return(false); }
public override bool RemoveChild(BehaviorNodeWindow child) { var result = base.RemoveChild(child); if (result) { childNode = null; } return(result); }
public override bool AddChild(int outputIndex, BehaviorNodeWindow child) { if (childNode != null || child.NodeType != BehaviorNodeType.Action) { return(false); } childNode = child; childNode.Parent = this; return(true); }
public override bool AddChild(int outputIndex, BehaviorNodeWindow child) { if (childNodes.Contains(child)) { return(false); } child.Parent = this; childNodes.Add(child); return(true); }
/// <summary> /// 创建节点 /// </summary> private BehaviorNodeWindow CreateBehaviorNodeWindow(int nodeID, BehaviorNodeType type, Vector2 pos) { BehaviorNodeWindow nodeWindow = null; switch (type) { case BehaviorNodeType.Action: nodeWindow = new ActionNodeWindow(nodeID); break; case BehaviorNodeType.Condition: nodeWindow = new ConditionNodeWindow(nodeID); break; case BehaviorNodeType.IfElse: nodeWindow = new IfElseNodeWindow(nodeID); break; case BehaviorNodeType.Selector: nodeWindow = new SelectorNodeWindow(nodeID); break; case BehaviorNodeType.Sequence: nodeWindow = new SequenceNodeWindow(nodeID); break; case BehaviorNodeType.Time: nodeWindow = new TimeNodeWindow(nodeID); break; case BehaviorNodeType.Parallel: nodeWindow = new ParallelNodeWindow(nodeID); break; case BehaviorNodeType.Loop: nodeWindow = new LoopNodeWindow(nodeID); break; } if (nodeWindow != null) { nodeWindow.WindowArea = new Rect(pos.x, pos.y, nodeWindow.WindowWidth, nodeWindow.WindowHeight); nodeWindows.Add(nodeWindow.ID, nodeWindow); } return(nodeWindow); }
public override bool RemoveChild(BehaviorNodeWindow child) { var result = base.RemoveChild(child); if (result) { if (conditionNode == child) { conditionNode = null; } else if (successNode == child) { successNode = null; } else if (failureNode == child) { failureNode = child; } } return(result); }
public MouseTransitionLine(BehaviorNodeWindow startNodeWindow, int outputIndex) { StartNodeWindow = startNodeWindow; OutputIndex = outputIndex; }
public NodeTransitionLine(BehaviorNodeWindow startNodeWindow, int outputIndex, BehaviorNodeWindow endNodeWindow) { StartNodeWindow = startNodeWindow; OutputIndex = outputIndex; EndNodeWindow = endNodeWindow; }