コード例 #1
0
    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();
    }
コード例 #2
0
 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);
 }
コード例 #3
0
        public static float InitialDelay(NodeTypeData data)
        {
            if (!data.RandomizeDelay)
            {
                return(data.InitialDelayMin);
            }

            return(Random.Range(data.InitialDelayMin, data.InitialDelayMax));
        }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
0
ファイル: NodeTypes.cs プロジェクト: cl4nk/NodalEditor
    /// <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);
            }
        }
    }
コード例 #6
0
    public static Node Create(string className)
    {
        NodeTypeData data = NodeTypes.getNodeData(className);

        return(Create(data.type));
    }
コード例 #7
0
        internal void RenameCategory(NodeTypeData data)
        {
            var index = m_categories.FindIndex(d => d.Guid == data.Guid);

            m_categories[index] = data;
        }
コード例 #8
0
 internal void AddCategory(NodeTypeData category)
 {
     m_categories.Add(category);
 }