public RenderNode AddNode(RenderNode node) { RenderNode existing = GetNodeByName(node.Name); if (string.IsNullOrEmpty(node.Name)) { throw new ArgumentException("Node needs a name"); } if (string.IsNullOrEmpty(node.Address)) { throw new ArgumentException("Node needs an address"); } if (existing != null) { throw new ArgumentException($"Already have a node with name {node.Name}"); } if (node.Name == LocalNodeName) { Nodes.Insert(0, node); } else { Nodes.Add(node); } OnNodeAdded?.Invoke(this, node); return(node); }
protected void AddOutputNode(BaseOutputNode node) { node.OnConnected += OnNodeConnected; node.OnDisconnect += OnNodeDisconnected; OutputNodes.Add(node); OnNodeAdded?.Invoke(this, node); }
public void AddNode(INode n) { Nodes.Add(n); OnGraphChanged?.Invoke(); OnNodeAdded?.Invoke(n); n.OnConnectorAdded += ConnectorAdded; n.OnConnectorRemoved += ConnectorRemoved; n.OnNodeRemoved += RemoveNode; }
public ScriptNode AddScriptNode <T>(ScriptNode node, string name = null) where T : struct, IScriptNodeJob { node.CreateScriptPlayable <T>(Behaviour.PlayableGraph); node.Playable.SetPropagateSetTime(true); SetAddedNodeName(node, name); node.Graph = this; Nodes.Add(node.Name, node); OnNodeAdded?.Invoke(node); return(node); }
private void GrowSplineFront() { var i = groundSpline.GetPointCount() - 1; var y = randomizer.Range(groundSpawnSettings.GroundYMin, groundSpawnSettings.GroundYMax); var leftTangent = Quaternion.identity * Vector3.left * randomizer.Range(groundSpawnSettings.TangentLengthMin, groundSpawnSettings.TangentLengthMax); var rightTangent = Quaternion.identity * Vector3.right * randomizer.Range(groundSpawnSettings.TangentLengthMin, groundSpawnSettings.TangentLengthMax); var distance = randomizer.Range(groundSpawnSettings.SplineNodeDistanceMin, groundSpawnSettings.SplineNodeDistanceMax); // We can't append at the end, so we move the last node ahead and insert a new one at its x position groundSpline.SetPosition(i, groundSpline.GetPosition(i) + Vector3.right * distance); groundSpline.InsertPointAt(i, new Vector3(LastSplineNodeX, y, 0f)); groundSpline.SetTangentMode(i, ShapeTangentMode.Continuous); groundSpline.SetLeftTangent(i, leftTangent); groundSpline.SetRightTangent(i, rightTangent); OnNodeAdded?.Invoke(groundSpline.GetPosition(i - 1), groundSpline.GetPosition(i)); }
public T AddNode <T>(T node, string name = null) where T : BaseNode { Assert.IsFalse(node is ScriptNode, $"Can't add node {name} because it's of type ScriptNode. Use AddScriptNode instead."); node.CreatePlayable(Behaviour.PlayableGraph); node.Playable.SetPropagateSetTime(true); SetAddedNodeName(node, name); node.Graph = this; Nodes.Add(node.Name, node); if (node is IUpdatableNode updatableNode) { UpdatableNodes.Add(updatableNode); } OnNodeAdded?.Invoke(node); return(node); }
private void _BroadcastListener_DeviceAvailable(object _, string content) { try { //logger.LogDebug("_BroadcastListener_DeviceAvailable called"); var node = JsonConvert.DeserializeObject <NodeInfo>(content); if ((node == null) || string.IsNullOrWhiteSpace(node.NodeGuid)) { logger.LogError("_BroadcastListener_DeviceAvailable receive invalid content: {0}", content); return; } OnNodeAdded?.Invoke(node); } catch (Exception exception) { logger.LogError(exception, "Error processing content from available device."); } }
/// <summary> /// <inheritdoc /> /// </summary> public void NodeAdded(NodeInstance instance) { OnNodeAdded?.Invoke(instance); }