public void SetColor(NodeType type) { NodeTypeData data = TypeDataHolder.Instance[type]; //不格好 if (type.HasTwoColors()) { LineRenderer.material.shader = oneOrTwoColorShader; LineRenderer.material.SetColor("_TintColor", data.BeamColor); LineRenderer.material.SetColor("_TintColor2", data.BeamColor2); LineRenderer.material.SetColor("_EmitColor", data.BeamEmit); } else if (type == NodeType.AllColor) { LineRenderer.material.shader = allColorShader; LineRenderer.material.SetColor("_EmitColor", data.BeamEmit); } else { LineRenderer.material.shader = oneOrTwoColorShader; LineRenderer.material.SetColor("_TintColor", data.BeamColor); LineRenderer.material.SetColor("_TintColor2", new Color(0, 0, 0, 0)); LineRenderer.material.SetColor("_EmitColor", data.BeamEmit); } Light(); }
private static void SetNodeTypeRow(DataRow row, NodeTypeData nodeType, List <NodeTypeData> allNodeTypes, MsSqlDataProvider dataProvider) { row["NodeTypeId"] = nodeType.Id; row["Name"] = nodeType.Name; row["ParentId"] = (object)allNodeTypes.FirstOrDefault(x => x.Name == nodeType.ParentName)?.Id ?? DBNull.Value; row["ClassName"] = nodeType.ClassName; row["Properties"] = string.Join(" ", nodeType.Properties); }
public static float InitialDelay(NodeTypeData data) { if (!data.RandomizeDelay) { return(data.InitialDelayMin); } return(Random.Range(data.InitialDelayMin, data.InitialDelayMax)); }
private void BuildResources(NodeItem root) { foreach (var nodeID in NodeTypes.GetCompatibleNodes(null)) { if (NodeCanvasManager.CheckCanvasCompability(nodeID, NodeEditor.curNodeCanvas.GetType())) { NodeTypeData nodeTypeData = NodeTypes.GetNodeData(nodeID); BuildSingleCategory(root, NodeTypes.GetNodeData(nodeID).adress, nodeTypeData.typeID); } } }
/// <summary> /// Fetches every Node Declaration in the script assemblies to provide the framework with custom node types /// </summary> public static void FetchNodeTypes() { nodes = new Dictionary <string, NodeTypeData> (); foreach (Type type in ReflectionUtility.getSubTypes(typeof(Node))) { object[] nodeAttributes = type.GetCustomAttributes(typeof(NodeAttribute), false); NodeAttribute attr = nodeAttributes[0] as NodeAttribute; if (attr == null || !attr.hide) { // Only regard if it is not marked as hidden // Fetch node information string className = type.FullName; string Title = "None"; Node sample = (Node)ScriptableObject.CreateInstance(type); Title = sample.Title; UnityEngine.Object.DestroyImmediate(sample); // Create Data from information NodeTypeData data = attr == null? // Switch between explicit information by the attribute or node information new NodeTypeData(className, Title, type, new Type[0]) : new NodeTypeData(className, attr.contextText, type, attr.limitToCanvasTypes); nodes.Add(className, data); } } }
public static Node Create(string className) { NodeTypeData data = NodeTypes.getNodeData(className); return(Create(data.type)); }
internal void RenameCategory(NodeTypeData data) { var index = m_categories.FindIndex(d => d.Guid == data.Guid); m_categories[index] = data; }
internal void AddCategory(NodeTypeData category) { m_categories.Add(category); }