/// <summary> /// Context Click selection. Here you'll need to register your own using a string identifier /// </summary> public void ContextCallback(object obj) { switch (obj.ToString()) { case "AI_actionNode": AI_ActionNode actionNode = AI_ActionNode.Create(new Rect(mousePos.x, mousePos.y, 100, 50)); break; case "Controller_actionNode": Controller_ActionNode.Create(new Rect(mousePos.x, mousePos.y, 100, 50)); break; case "AI_conditionNode": AI_ConditionNode conditionNode = AI_ConditionNode.Create(new Rect(mousePos.x, mousePos.y, 100, 50)); break; case "Controller_conditionNode": Controller_ConditionNode.Create(new Rect(mousePos.x, mousePos.y, 100, 50)); break; case "Start_StepNode": StartStepNode.Create(new Rect(mousePos.x, mousePos.y, 100, 50)); break; case "End_StepNode": EndStepNode.Create(new Rect(mousePos.x, mousePos.y, 100, 50)); break; case "deleteLinkTo": Node n = NodeAtPosition(mousePos); n.Linkers[(int)Node.LinkType.To].connection = null; n.Linkers[(int)Node.LinkType.To].connectionID = -1; break; case "deleteLinkToOK": Node n1 = NodeAtPosition(mousePos); n1.Linkers[(int)Node.LinkType.ToOK].connection = null; n1.Linkers[(int)Node.LinkType.ToOK].connectionID = -1; break; case "deleteLinkToKO": Node n2 = NodeAtPosition(mousePos); n2.Linkers[(int)Node.LinkType.ToKO].connection = null; n2.Linkers[(int)Node.LinkType.ToKO].connectionID = -1; break; case "deleteNode": Node node = NodeAtPosition(mousePos); if (node != null && (node.name != "Root" && node.name != "End")) { nodeCanvas.nodes.Remove(node); node.OnDelete(); } break; } }
public static EndStepNode Create(Rect NodeRect) { EndStepNode node = ScriptableObject.CreateInstance <EndStepNode>(); node.name = "End Step"; node.rect = NodeRect; node.Init(); NodeLinker.Create(node, "Link To", (int)Node.LinkType.To); NodeLinker.Create(node, "Link From", (int)Node.LinkType.From); return(node); }