[
  {
    "path": ".gitignore",
    "content": "/[Ll]ibrary/\n/[Tt]emp/\n/[Oo]bj/\n/[Bb]uild/\n/[Bb]uilds/\n/Assets/AssetStoreTools*\n/Assets/UnityTestTools*\n/Assets/UnityTestTools.meta\n\n\n# Autogenerated VS/MD solution and project files\nExportedObj/\n*.csproj\n*.unityproj\n*.sln\n*.suo\n*.tmp\n*.user\n*.userprefs\n*.pidb\n*.booproj\n*.svd\n\n\n# Unity3D generated meta files\n*.pidb.meta\n\n# Unity3D Generated File On Crash Reports\nsysinfo.txt\n\n# Builds\n*.apk\n*.unitypackage\n\n# IDE: JetBrains Rider EAP\n.idea\n\n# OSX\n.DS_Store\n"
  },
  {
    "path": "Assets/Code/Bon/BonConfig.cs",
    "content": "﻿namespace Assets.Code.Bon\n{\n\tpublic static class BonConfig\n\t{\n\t\tpublic static int Version = 1;\n\n\t\tpublic static int LogLevel = 1;\n\n\t\tpublic static int SocketSize = 15;\n\t\tpublic static int SocketOffsetTop = 20;\n\t\tpublic static int SocketMargin = 5;\n\t\tpublic static int EdgeTangent = 50;\n\n\t\tpublic static string DefaultGraphName = \"default\";\n\t\tpublic static string GameObjectName = \"Bon\";\n\t}\n}\n\n\n"
  },
  {
    "path": "Assets/Code/Bon/BonConfig.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0ddf11f69c16c460a924b58c4122315a\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/BonLauncher.cs",
    "content": "﻿using System.Collections.Generic;\nusing UnityEngine;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Nodes.Noise;\nusing Assets.Code.Bon.Nodes.Number;\nusing Assets.Code.Bon.Socket;\n\n\nnamespace Assets.Code.Bon\n{\n\t/// <summary>\n\t/// A class to controll the creation of Graphs. It contains loaded Grpahs.\n\t/// (A gameobject with this script is created by the editor if it is not in the scene)\n\t/// </summary>\n\t[ExecuteInEditMode]\n\t[System.Serializable]\n\tpublic class BonLauncher : MonoBehaviour\n\t{\n\n\t\tprivate List<Graph> _graphs = new List<Graph>();\n\n\t\tprivate StandardGraphController _controller;\n\n\t\tpublic List<Graph> Graphs\n\t\t{\n\t\t\tget { return _graphs; }\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Loads a graph by its path, adds it to the internal list\n\t\t/// and returns it.\n\t\t/// (Also used by the editor to open Graphs)\n\t\t/// </summary>\n\t\tpublic Graph LoadGraph(string path)\n\t\t{\n\t\t\tGraph g;\n\t\t\tif (path.Equals(BonConfig.DefaultGraphName)) g = CreateDefaultGraph();\n\t\t\telse g = Graph.Load(path);\n\t\t\tg.Name = path;\n\t\t\tGraphs.Add(g);\n\t\t\tCreateGraphController(g);\n\t\t\tg.UpdateNodes();\n\t\t\treturn g;\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Saves a graph by its path.\n\t\t/// (Also used by the editor to save Graphs)\n\t\t/// </summary>\n\t\tpublic void SaveGraph(Graph g, string path)\n\t\t{\n\t\t\tGraph.Save(path, g);\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Removes a Graph from the internal list.\n\t\t/// (Also used by the editor to close Graphs)\n\t\t/// </summary>\n\t\tpublic void RemoveGraph(Graph g)\n\t\t{\n\t\t\tGraphs.Remove(g);\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Returns the graph at the index\n\t\t/// </summary>\n\t\tpublic Graph GetGraph(int index)\n\t\t{\n\t\t\treturn Graphs[index];\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Create a controller for the assigned Graph.\n\t\t/// </summary>\n\t\tprivate void CreateGraphController(Graph graph)\n\t\t{\n\t\t\t// in this case we create one controller for all graphs\n\t\t\t// you could also create different controllers for different graphs\n\t\t\t//if (_controller == null) _controller = new StandardGraphController();\n\t\t}\n\n\t\tpublic void OnEnable()\n\t\t{\n\t\t\tif (_controller == null) _controller = new StandardGraphController();\n\t\t\t_controller.Register();\n\n\t\t\tforeach (var graph in Graphs)\n\t\t\t{\n\t\t\t\tgraph.ResetVisitCount();\n\t\t\t}\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Creates a default Graph.\n\t\t/// (see: BonConfig.DefaultGraphName)\n\t\t/// </summary>\n\t\tpublic Graph CreateDefaultGraph()\n\t\t{\n\t\t\tGraph graph = new Graph();\n\n\t\t\t// Number Nodes\n\t\t\tvar operator01 = (NumberOperatorNode) graph.CreateNode<NumberOperatorNode>();\n\t\t\toperator01.X = 200;\n\t\t\toperator01.Y = 40;\n\t\t\toperator01.SetMode(Operator.Add);\n\t\t\tgraph.AddNode(operator01);\n\n\t\t\tvar diplay01 = (NumberDisplayNode) graph.CreateNode<NumberDisplayNode>();\n\t\t\tdiplay01.X = 330;\n\t\t\tdiplay01.Y = 80;\n\t\t\tgraph.AddNode(diplay01);\n\n\t\t\tgraph.Link(\n\t\t\t\t(InputSocket) diplay01.GetSocket(typeof(AbstractNumberNode), typeof(InputSocket), 0),\n\t\t\t\t(OutputSocket) operator01.GetSocket(typeof(AbstractNumberNode), typeof(OutputSocket), 0));\n\n\t\t\t// Map2D Nodes\n\t\t\tvar perlinNoise = graph.CreateNode<UnityPerlinNoiseNode>();\n\t\t\tperlinNoise.X = 80;\n\t\t\tperlinNoise.Y = 250;\n\t\t\tgraph.AddNode(perlinNoise);\n\n\t\t\tvar displayMap = graph.CreateNode<NoiseDisplayNode>();\n\t\t\tdisplayMap.X = 300;\n\t\t\tdisplayMap.Y = 280;\n\t\t\tgraph.AddNode(displayMap);\n\n\t\t\tgraph.Link(\n\t\t\t\t(InputSocket) displayMap.GetSocket(typeof(AbstractNumberNode), typeof(InputSocket), 0),\n\t\t\t\t(OutputSocket) perlinNoise.GetSocket(typeof(AbstractNumberNode), typeof(OutputSocket), 0));\n\n\n\t\t\t// == test serialization an deserialization ==\n\t\t\tvar serializedJSON = graph.ToJson();\n\t\t\tvar deserializedGraph = Graph.FromJson(serializedJSON);\n\t\t\t// =====\n\n\t\t\treturn deserializedGraph;\n\t\t}\n\n\t}\n}\n\n\n"
  },
  {
    "path": "Assets/Code/Bon/BonLauncher.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e38ce1fc262ac4cfc85e55f297ffc7b8\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Edge.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEditor;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon\n{\n\n\tpublic class Edge\n\t{\n\t\tpublic InputSocket Input;\n\t\tpublic OutputSocket Output;\n\n\t\t// cached vectors for drawing\n\t\tprivate Vector2 _tmpStartPos;\n\t\tprivate Vector2 _tmpEndPos;\n\t\tprivate Vector2 _tmpTangent01;\n\t\tprivate Vector2 _tmpTangent02;\n\n\t\tpublic Edge(OutputSocket outputSocket, InputSocket inputSocket)\n\t\t{\n\t\t\tInput = inputSocket;\n\t\t\tOutput = outputSocket;\n\t\t}\n\n\t\tpublic AbstractSocket GetOtherSocket(AbstractSocket socket)\n\t\t{\n\t\t\tif (socket == Input) return Output;\n\t\t\treturn Input;\n\t\t}\n\n\t\tpublic void Draw()\n\t\t{\n\t\t\tif (Input != null && Output != null)\n\t\t\t{\n\t\t\t\t_tmpStartPos = GetEdgePosition(Output, _tmpStartPos);\n\t\t\t\t_tmpEndPos = GetEdgePosition(Input, _tmpEndPos);\n\t\t\t\t_tmpTangent01 = GetTangentPosition(Output, _tmpStartPos);\n\t\t\t\t_tmpTangent02 = GetTangentPosition(Input, _tmpEndPos);\n\t\t\t\tDrawEdge(_tmpStartPos, _tmpTangent01, _tmpEndPos, _tmpTangent02, Output.Type);\n\n\t\t\t\tHandles.color = Color.black;\n\t\t\t\t_tmpStartPos.Set(_tmpEndPos.x - 5, _tmpEndPos.y - 5);\n\t\t\t\tHandles.DrawLine(_tmpEndPos, _tmpStartPos);\n\t\t\t\t_tmpStartPos.Set(_tmpEndPos.x - 5, _tmpEndPos.y + 5);\n\t\t\t\tHandles.DrawLine(_tmpEndPos, _tmpStartPos);\n\t\t\t}\n\t\t}\n\n\t\tpublic static void DrawEdge(Vector2 position01, Vector2 tangent01, Vector2 position02, Vector2 tangent02, Type type)\n\t\t{\n\t\t\tHandles.DrawBezier(\n\t\t\t\tposition01, position02,\n\t\t\t\ttangent01, tangent02, Color.black, null, 6);\n\n\t\t\tHandles.DrawBezier(\n\t\t\t\tposition01, position02,\n\t\t\t\ttangent01, tangent02, Node.GetEdgeColor(type), null, 3);\n\t\t}\n\n\t\tpublic static Vector2 GetEdgePosition(AbstractSocket socket, Vector2 position)\n\t\t{\n\t\t\tif (socket.Parent.Collapsed)\n\t\t\t{\n\t\t\t\tfloat width = BonConfig.SocketSize;\n\t\t\t\tif (socket.IsOutput()) width = 0;\n\t\t\t\tposition.Set(socket.X + width, socket.Parent.WindowRect.y + 8);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfloat width = 0;\n\t\t\t\tif (socket.IsOutput()) width = BonConfig.SocketSize;\n\t\t\t\tposition.Set(socket.X + width, socket.Y + BonConfig.SocketSize / 2f);\n\t\t\t}\n\t\t\treturn position;\n\t\t}\n\n\t\tpublic static Vector2 GetTangentPosition(AbstractSocket socket, Vector2 position)\n\t\t{\n\t\t\tif (socket.IsInput()) return position + Vector2.left*BonConfig.EdgeTangent;\n\t\t\treturn position + Vector2.right*BonConfig.EdgeTangent;\n\t\t}\n\n\t\t///<summary>Creates a serializable version of this edge.</summary>\n\t\t/// <returns>A serializable version of this edge.</returns>\n\t\tpublic SerializableEdge ToSerializedEgde()\n\t\t{\n\t\t\tSerializableEdge s = new SerializableEdge();\n\t\t\ts.InputNodeId = Input.Parent.Id;\n\t\t\ts.InputSocketIndex = Input.Parent.Sockets.IndexOf(Input);\n\t\t\ts.OutputNodeId = Output.Parent.Id;\n\t\t\ts.OutputSocketIndex = Output.Parent.Sockets.IndexOf(Output);\n\t\t\treturn s;\n\t\t}\n\t}\n\n\n\t[Serializable] public class SerializableEdge\n\t{\n\t\t[SerializeField] public int OutputNodeId = -1;\n\t\t[SerializeField] public int OutputSocketIndex = -1;\n\t\t[SerializeField] public int InputNodeId = -1;\n\t\t[SerializeField] public int InputSocketIndex = -1;\n\t}\n}\n\n\n"
  },
  {
    "path": "Assets/Code/Bon/Edge.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 2ad1c6a7475ad4b63b637085f23cc8ed\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/EventManager.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing Assets.Code.Bon;\n\npublic class EventManager\n{\n\n\tpublic delegate void GraphAction(Graph graph);\n\tpublic delegate void EdgeAction(Graph graph, Edge edge);\n\tpublic delegate void SocketAction(Graph graph, AbstractSocket s01, AbstractSocket s02);\n\tpublic delegate void NodeAction(Graph graph, Node node);\n\n\tpublic delegate void WindowAction();\n\n\tpublic static event GraphAction OnCreateGraph;\n\tpublic static event GraphAction OnFocusGraph;\n\tpublic static event GraphAction OnCloseGraph;\n\n\tpublic static event EdgeAction OnLinkEdge;\n\n\tpublic static event SocketAction OnUnLinkSockets;\n\tpublic static event SocketAction OnUnLinkedSockets;\n\n\tpublic static event NodeAction OnAddedNode;\n\tpublic static event NodeAction OnChangedNode;\n\tpublic static event NodeAction OnFocusNode;\n\tpublic static event NodeAction OnNodeRemoved;\n\n\tpublic static event WindowAction OnEditorWindowOpen;\n\n\n\tpublic static void TriggerOnCreateGraph(Graph graph)\n\t{\n\t\tif (OnCreateGraph != null) OnCreateGraph(graph);\n\t}\n\n\tpublic static void TriggerOnFocusGraph(Graph graph)\n\t{\n\t\tif (OnFocusGraph != null) OnFocusGraph(graph);\n\t}\n\n\tpublic static void TriggerOnCloseGraph(Graph graph)\n\t{\n\t\tif (OnCloseGraph != null) OnCloseGraph(graph);\n\t}\n\n\tpublic static void TriggerOnLinkEdge(Graph graph, Edge edge)\n\t{\n\t\tif (OnLinkEdge != null) OnLinkEdge(graph, edge);\n\t}\n\n\tpublic static void TriggerOnUnLinkSockets(Graph graph, AbstractSocket socket01, AbstractSocket socket02)\n\t{\n\t\tif (OnUnLinkSockets != null) OnUnLinkSockets(graph, socket01, socket02);\n\t}\n\n\tpublic static void TriggerOnUnLinkedSockets(Graph graph, AbstractSocket socket01, AbstractSocket socket02)\n\t{\n\t\tif (OnUnLinkedSockets != null) OnUnLinkedSockets(graph, socket01, socket02);\n\t}\n\n\tpublic static void TriggerOnAddedNode(Graph graph, Node node)\n\t{\n\t\tif (OnAddedNode != null) OnAddedNode(graph, node);\n\t}\n\n\tpublic static void TriggerOnChangedNode(Graph graph, Node node)\n\t{\n\t\tif (OnChangedNode != null) OnChangedNode(graph, node);\n\t}\n\n\tpublic static void TriggerOnFocusNode(Graph graph, Node node)\n\t{\n\t\tif (OnFocusNode != null) OnFocusNode(graph, node);\n\t}\n\n\tpublic static void TriggerOnNodeRemoved(Graph graph, Node node)\n\t{\n\t\tif (OnNodeRemoved != null) OnNodeRemoved(graph, node);\n\t}\n\n\tpublic static void TriggerOnWindowOpen()\n\t{\n\t\tif (OnEditorWindowOpen != null) OnEditorWindowOpen();\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/EventManager.cs.meta",
    "content": "fileFormatVersion: 2\nguid: eb8c51ff08ff34381af21f090ee787a0\ntimeCreated: 1470310655\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Graph.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon\n{\n\n\t[Serializable]\n\tpublic class Graph : ISerializationCallbackReceiver\n\t{\n\n\t\t[SerializeField] public string Name;\n\n\t\tprivate List<Node> _nodes = new List<Node>();\n\n\t\t[HideInInspector] [SerializeField] private List<SerializableEdge> _serializedEdges = new List<SerializableEdge>();\n\t\t[HideInInspector] [SerializeField] private List<SerializableNode> _serializedNodes = new List<SerializableNode>();\n\t\t[SerializeField] public int Version = BonConfig.Version;\n\n\t\t// be warned to allow circles.. if you parse the graph you can end up in\n\t\t// an endless recursion this can crash unity.\n\t\t[HideInInspector] [SerializeField] public bool AllowCicles = false;\n\n\t\tprivate bool _invalidating;\n\n\t\tprivate bool _needsUpdate = true; [NonSerialized] public bool TriggerEvents = true;\n\n\t\t/// <summary>Returns an id for a Node that is unique for this Graph.</summary>\n\t\t/// <returns> An id for a Node that is unique for this Graph.</returns>\n\t\tpublic int ObtainUniqueNodeId()\n\t\t{\n\t\t\tvar tmpId = 0;\n\t\t\twhile (GetNode(tmpId) != null) tmpId++;\n\t\t\treturn tmpId;\n\t\t}\n\n\t\t/// <summary>Creates a Node of the given type. Type must inherit from Node.\n\t\t/// Does not add the Node to the Graph.</summary>\n\t\t/// <returns>The created Node of the given Type.</returns>\n\t\tpublic Node CreateNode<T>()\n\t\t{\n\t\t\treturn CreateNode<T>(ObtainUniqueNodeId());\n\t\t}\n\n\t\t/// <summary>Creates a Node of the given type with the assigned id. Type must inherit from Node.\n\t\t/// Does not add the Node to the Graph.</summary>\n\t\t/// <returns>The created Node of the given Type with the assigned id.</returns>\n\t\tpublic Node CreateNode<T>(int id)\n\t\t{\n\t\t\treturn CreateNode(typeof(T), id);\n\t\t}\n\n\t\t/// <summary>Creates a Node of the given type. Type must inherit from Node.\n\t\t/// Does not add the Node to the Graph.</summary>\n\t\t/// <param name=\"type\">The Type of the Node to create.</param>\n\t\t/// <returns>The created Node of the given Type.</returns>\n\t\tpublic Node CreateNode(Type type)\n\t\t{\n\t\t\treturn CreateNode(type, ObtainUniqueNodeId());\n\t\t}\n\n\t\t/// <summary>Creates a Node of the given type with the assigned id. Type must inherit from Node.\n\t\t/// Does not add the Node to the Graph.</summary>\n\t\t/// <param name=\"type\">The Type of the Node to create.</param>\n\t\t/// <param name=\"id\">The id of the Node to create.</param>\n\t\t/// <returns>The created Node of the given Type with the assigned id.</returns>\n\t\tpublic Node CreateNode(Type type, int id)\n\t\t{\n\t\t\tif (type == null) return null;\n\t\t\t_needsUpdate = true;\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn (Node) Activator.CreateInstance(type, id, this);\n\t\t\t}\n\t\t\tcatch (Exception exception)\n\t\t\t{\n\t\t\t\tDebug.LogErrorFormat(\"Node {0} could not be created \" + exception.Message, type.FullName);\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\t/// <summary>Returns the Node with the assigned id or null.</summary>\n\t\t/// <param name=\"nodeId\">The id of the Node to get.</param>\n\t\t/// <returns>The Node with the assigned id or null.</returns>\n\t\tpublic Node GetNode(int nodeId)\n\t\t{\n\t\t\tif (_nodes == null) return null;\n\t\t\tforeach (var node in _nodes) if (node.Id == nodeId) return node;\n\t\t\treturn null;\n\t\t}\n\n\t\t/// <summary>Returns the count of Nodes in this Graph.</summary>\n\t\t/// <returns>The count of Nodes in this Graph.</returns>\n\t\tpublic int GetNodeCount()\n\t\t{\n\t\t\treturn _nodes.Count;\n\t\t}\n\n\t\t/// <summary>Returns the Node at the assigned index.</summary>\n\t\t/// <param name=\"index\">The index of the Node to get.</param>\n\t\t/// <returns>The Node at the assigned index.</returns>\n\t\tpublic Node GetNodeAt(int index)\n\t\t{\n\t\t\tif (index >= _nodes.Count) return null;\n\t\t\treturn _nodes[index];\n\t\t}\n\n\t\t/// <summary>Adds a node to the Graph. Does not add Nodes with an id that is already taken.\n\t\t/// Triggers a 'AddedNode' event. </summary>\n\t\t/// <param name=\"node\">The Node to add.</param>\n\t\t/// <returns>True if the node was added.</returns>\n\t\tpublic bool AddNode(Node node)\n\t\t{\n\t\t\tif (GetNode(node.Id) != null) return false;\n\t\t\t_needsUpdate = true;\n\t\t\t_nodes.Add(node);\n\t\t\tif (TriggerEvents) EventManager.TriggerOnAddedNode(this, node);\n\t\t\treturn true;\n\t\t}\n\n\t\t/// <summary>Removes the assigned Node from this Graph.</summary>\n\t\t/// <param name=\"node\">The Node to remove.</param>\n\t\t/// <returns>True if the Node was removed.</returns>\n\t\tpublic bool RemoveNode(Node node)\n\t\t{\n\t\t\tif (node == null) return false;\n\t\t\t_needsUpdate = true;\n\n\t\t\tforeach (var socket in node.Sockets) UnLink(socket);\n\t\t\tbool removed = _nodes.Remove(node);\n\t\t\tif (TriggerEvents) EventManager.TriggerOnNodeRemoved(this, node);\n\t\t\treturn removed;\n\t\t}\n\n\t\t/// <summary>Removes the Node with the assigned id from this Graph.</summary>\n\t\t/// <param name=\"id\">The id of the Node to remove.</param>\n\t\t/// <returns>True if the Node was removed.</returns>\n\t\tpublic bool RemoveNode(int id)\n\t\t{\n\t\t\treturn RemoveNode(GetNode(id));\n\t\t}\n\n\t\tpublic bool AreConected(InputSocket inputSocket, OutputSocket outputSocket)\n\t\t{\n\t\t\tif (inputSocket == null || outputSocket == null || inputSocket.Edge == null || outputSocket.Edges.Count == 0) return false;\n\t\t\treturn outputSocket.Edges.Contains(inputSocket.Edge);\n\t\t}\n\n\t\t/// <summary>Unlinkes the assigned sockets. Triggeres 'Unlink' events.</summary>\n\t\tpublic void UnLink(InputSocket inputSocket, OutputSocket outputSocket)\n\t\t{\n\t\t\t_needsUpdate = true;\n\n\t\t\tif (inputSocket == null || outputSocket == null || !inputSocket.IsConnected() || !outputSocket.IsConnected()) return;\n\t\t\tif (!AreConected(inputSocket, outputSocket)) return;\n\n\t\t\tif (TriggerEvents)\n\t\t\t{\n\t\t\t\tEventManager.TriggerOnUnLinkSockets(this, inputSocket, outputSocket);\n\t\t\t}\n\n\t\t\tvar index = outputSocket.Edges.IndexOf(inputSocket.Edge);\n\t\t\tif (index > -1)\n\t\t\t{\n\t\t\t\toutputSocket.Edges[index].Input = null;\n\t\t\t\toutputSocket.Edges[index].Output = null;\n\t\t\t\toutputSocket.Edges.RemoveAt(index);\n\t\t\t}\n\n\t\t\tinputSocket.Edge.Input = null;\n\t\t\tinputSocket.Edge.Output = null;\n\t\t\tinputSocket.Edge = null;\n\n\t\t\tif (TriggerEvents)\n\t\t\t{\n\t\t\t\tEventManager.TriggerOnUnLinkedSockets(this, inputSocket, outputSocket);\n\t\t\t}\n\t\t}\n\n\t\tpublic void UnLink(AbstractSocket socket)\n\t\t{\n\t\t\tif (socket == null || !socket.IsConnected()) return;\n\n\n\t\t\tif (socket.IsInput())\n\t\t\t{\n\t\t\t\tInputSocket inputSocket = (InputSocket) socket;\n\t\t\t\tif (inputSocket.Edge != null) UnLink(inputSocket, inputSocket.Edge.Output);\n\t\t\t}\n\n\t\t\tif (socket.IsOutput())\n\t\t\t{\n\t\t\t\tOutputSocket outputSocket = (OutputSocket) socket;\n\t\t\t\tEdge[] edgeCopy = new Edge[outputSocket.Edges.Count];\n\t\t\t\toutputSocket.Edges.CopyTo(edgeCopy);\n\t\t\t\tforeach (var edge in edgeCopy)\n\t\t\t\t{\n\t\t\t\t\tUnLink(edge.Input, outputSocket);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool Link(InputSocket inputSocket, OutputSocket outputSocket)\n\t\t{\n\t\t\tif (!CanBeLinked(inputSocket, outputSocket))\n\t\t\t{\n\t\t\t\tDebug.LogWarning(\"Sockets can not be linked.\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t_needsUpdate = true;\n\n\t\t\tif (inputSocket.Type == outputSocket.Type)\n\t\t\t{\n\t\t\t\tEdge edge = new Edge(outputSocket, inputSocket);\n\t\t\t\tEdge oldEdge = inputSocket.Edge;\n\t\t\t\tinputSocket.Edge = edge;\n\t\t\t\toutputSocket.Edges.Add(edge);\n\n\t\t\t\tif (!AllowCicles && HasCycle())\n\t\t\t\t{\n\t\t\t\t\t// revert\n\t\t\t\t\tinputSocket.Edge = oldEdge;\n\t\t\t\t\toutputSocket.Edges.Remove(edge);\n\t\t\t\t\tLog.Info(\"Can not link sockets. Circles are not allowed.\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (TriggerEvents)\n\t\t\t\t{\n\t\t\t\t\tEventManager.TriggerOnLinkEdge(this, edge);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate void StartVisitRun()\n\t\t{\n\t\t\tif (_invalidating) \n\t\t\t{\n\t\t\t\tthrow new UnityException (\"Graph is already invalidating\");\n\t\t\t}\n\n\t\t\t_invalidating = true;\n\t\t\tResetVisitCount();\n\t\t}\n\n\t\tpublic void ResetVisitCount()\n\t\t{\n\t\t\tforeach (var node in _nodes)\n\t\t\t{\n\t\t\t\tnode.VisitCount = 0;\n\t\t\t}\n\t\t}\n\n\t\tprivate void EndVisitRun()\n\t\t{\n\t\t\t_invalidating = false;\n\t\t}\n\n\n\t\tpublic bool HasCycle() {\n\t\t\tforeach (var node in _nodes)\n\t\t\t{\n\t\t\t\tStartVisitRun(); // resets visit counter\n\t\t\t\tbool foundCicle = IsConnectedToItself(node);\n\t\t\t\tEndVisitRun();\n\t\t\t\tif (foundCicle) return true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t/// <summary>\n\t\t/// This method returns true is a node is connected to itself along the output path.\n\t\t/// Reset the 'VisitCount' counter of each node before calling! Call this\n\t\t/// method ignoring the optional parameter. This is used internaly for recursion.\n\t\t/// <param name=\"searchForNode\">The node you want to check</param>\n\t\t/// <param name=\"recursionNode\">Do not use this parameter or assign null</param>\n\t\t/// </summary>\n\t\tprivate bool IsConnectedToItself(Node searchForNode, Node recursionNode = null)\n\t\t{\n\t\t\tbool firstRun = recursionNode == null;\n\t\t\tif (firstRun) recursionNode = searchForNode;\n\t\t\tif (!firstRun && recursionNode == searchForNode) return true; // visited the first node after recursion\n\t\t\tif (recursionNode.VisitCount > 0) return false; // already checked\n\t\t\trecursionNode.VisitCount++;\n\n\t\t\tforeach (var socket in recursionNode.Sockets) // follow the OutputSockets of the node\n\t\t\t{\n\t\t\t\tif (socket.IsOutput() && socket.IsConnected())\n\t\t\t\t{\n\t\t\t\t\tOutputSocket outputSocket = (OutputSocket) socket;\n\t\t\t\t\tforeach (var edge in outputSocket.Edges) // check every edge\n\t\t\t\t\t{\n\t\t\t\t\t\tif (edge.Input.Parent != null && IsConnectedToItself(searchForNode, edge.Input.Parent)) return true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic void UpdateDependingNodes(Node node)\n\t\t{\n\t\t\tStartVisitRun();\n\t\t\tUpdateOutputPath(node);\n\t\t\tEndVisitRun();\n\t\t}\n\n\t\t/// <summary>\n\t\t/// This method follows the ouput path of the node and updates all visited nodes.\n\t\t/// Reset the 'VisitCount' counter of each node before calling!\n\t\t/// </summary>\n\t\t/// <param name=\"node\">The node to update and its ouput path nodes</param>\n\t\tprivate void UpdateOutputPath(Node node)\n\t\t{\n\t\t\tif (node.VisitCount > 0) return; // already updated\n\t\t\tnode.Update();\n\t\t\tnode.VisitCount++;\n\n\t\t\tforeach (var socket in node.Sockets) // follow the OutputSockets of the node\n\t\t\t{\n\t\t\t\tif (socket.IsOutput() && socket.IsConnected())\n\t\t\t\t{\n\t\t\t\t\tOutputSocket outputSocket = (OutputSocket) socket;\n\t\t\t\t\tforeach (var edge in outputSocket.Edges)\n\t\t\t\t\t{\n\t\t\t\t\t\tUpdateOutputPath(edge.Input.Parent);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\t/// <summary> Returns true if the sockets can be linked.</summary>\n\t\t/// <param name=\"inSocket\"> The input socket</param>\n\t\t/// <param name=\"outSocket\"> The output socket</param>\n\t\t/// <returns>True if the sockets can be linked.</returns>\n\t\tpublic bool CanBeLinked(InputSocket inSocket, OutputSocket outSocket)\n\t\t{\n\t\t\treturn inSocket != null && outSocket != null && outSocket.Type == inSocket.Type;\n\t\t}\n\n\t\tpublic void LogCircleError()\n\t\t{\n\t\t\tDebug.LogError(\"The graph contains ciclyes.\");\n\t\t}\n\n\t\t// === SERIALIZATION ===\n\n\t\tpublic string ToJson()\n\t\t{\n\t\t\treturn JsonUtility.ToJson(this);\n\t\t}\n\n\t\tpublic static Graph FromJson(string json)\n\t\t{\n\t\t\tGraph g = JsonUtility.FromJson<Graph>(json);\n\t\t\t//listener.OnCreate(g);\n\t\t\tEventManager.TriggerOnCreateGraph(g);\n\t\t\treturn g;\n\t\t}\n\n\t\tpublic static bool Save(string fileName, Graph graph)\n\t\t{\n\t\t\tvar file = File.CreateText(fileName);\n\t\t\tfile.Write((string) graph.ToJson());\n\t\t\tfile.Close();\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic static Graph Load(string fileName)\n\t\t{\n\t\t\tif(File.Exists(fileName)){\n\t\t\t\tvar file = File.OpenText(fileName);\n\t\t\t\tvar json = file.ReadToEnd();\n\t\t\t\tfile.Close();\n\t\t\t\tGraph deserializedGraph = FromJson(json);\n\t\t\t\tif (deserializedGraph.Version != BonConfig.Version)\n\t\t\t\t{\n\t\t\t\t\tDebug.LogWarning(\"You loading a graph with a different version number: \" + deserializedGraph.Version +\n\t\t\t\t\t\t\" the current version is \" + BonConfig.Version);\n\t\t\t\t}\n\t\t\t\treturn deserializedGraph;\n\t\t\t} else {\n\t\t\t\tDebug.Log(\"Could not Open the file: \" + fileName);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tpublic void UpdateNodes()\n\t\t{\n\t\t\tif (!_needsUpdate) return;\n\n\t\t\tforeach (var node in _nodes)\n\t\t\t{\n\t\t\t\tnode.Update();\n\t\t\t}\n\t\t\t_needsUpdate = false;\n\t\t}\n\n\t\tpublic void ForceUpdateNodes()\n\t\t{\n\t\t\t_needsUpdate = true;\n\t\t\tUpdateNodes ();\n\t\t}\n\n\t\t/// <summary>Unity serialization callback.</summary>\n\t\tpublic void OnBeforeSerialize()\n\t\t{\n\t\t\tif (_nodes.Count == 0) return; // nothing to serialize\n\t\t\tbool wasTriggering = TriggerEvents;\n\t\t\tTriggerEvents = false;\n\n\t\t\t_serializedEdges.Clear();\n\t\t\t_serializedNodes.Clear();\n\t\t\t// serialize data\n\t\t\tforeach (var node in _nodes)\n\t\t\t{\n\t\t\t\t_serializedNodes.Add(node.ToSerializedNode());\n\t\t\t\tforeach (var socket in node.Sockets)\n\t\t\t\t{\n\t\t\t\t\tif (socket.IsInput() && socket.IsConnected()) // serialize only input socket edges to avoid double edge serialization\n\t\t\t\t\t{\n\t\t\t\t\t\tInputSocket inputSocket = (InputSocket) socket;\n\t\t\t\t\t\t_serializedEdges.Add(inputSocket.Edge.ToSerializedEgde());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tTriggerEvents = wasTriggering;\n\t\t}\n\n\t\t/// <summary>Unity serialization callback.</summary>\n\t\tpublic void OnAfterDeserialize()\n\t\t{\n\t\t\tif (_serializedNodes.Count == 0) return;\t// Nothing to deserialize.\n\t\t\tbool wasTriggering = TriggerEvents;\n\t\t\tTriggerEvents = false;\n\n\t\t\t_nodes.Clear(); // clear original data.\n\n\t\t\t// deserialize nodes\n\t\t\tforeach (var sNode in _serializedNodes)\n\t\t\t{\n\t\t\t\tType nodeType = Type.GetType(sNode.type);\n\t\t\t\tif (nodeType == null)\n\t\t\t\t{\n\t\t\t\t\tDebug.LogWarning(\"Unknown node type: \" + sNode.type);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tNode n = CreateNode(nodeType, sNode.id);\n\t\t\t\tif (n != null)\n\t\t\t\t{\n\t\t\t\t\tJsonUtility.FromJsonOverwrite(sNode.data, n);\n\t\t\t\t\tn.OnDeserialization(sNode);\n\t\t\t\t\tn.X = sNode.X;\n\t\t\t\t\tn.Y = sNode.Y;\n\n\t\t\t\t\tfor (var i = 0; i < sNode.directInputValues.Length; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (n.Sockets[i].IsInput())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tInputSocket inputSocket = (InputSocket) n.Sockets[i];\n\t\t\t\t\t\t\tinputSocket.SetDirectInputNumber(sNode.directInputValues[i], false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (sNode.Collapsed) n.Collapse();\n\t\t\t\t\tAddNode(n);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// deserialize edges\n\t\t\tforeach (var sEdge in _serializedEdges)\n\t\t\t{\n\t\t\t\tNode inputNode = GetNode(sEdge.InputNodeId);\n\t\t\t\tNode outputNode = GetNode(sEdge.OutputNodeId);\n\t\t\t\tif (inputNode == null || outputNode == null)\n\t\t\t\t{\n\t\t\t\t\tDebug.LogWarning(\"Try to create an edge but can not find at least on of the nodes.\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (sEdge.OutputSocketIndex > outputNode.Sockets.Count || sEdge.InputSocketIndex > inputNode.Sockets.Count)\n\t\t\t\t{\n\t\t\t\t\tDebug.LogWarning(\"Try to create an edge but can not find at least on of the sockets.\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tInputSocket inputSocket = (InputSocket) inputNode.Sockets[sEdge.InputSocketIndex];\n\t\t\t\tOutputSocket outputSocket = (OutputSocket) outputNode.Sockets[sEdge.OutputSocketIndex];\n\t\t\t\tEdge edge = new Edge(outputSocket, inputSocket);\n\t\t\t\tinputSocket.Edge = edge;\n\t\t\t\toutputSocket.Edges.Add(edge);\n\t\t\t}\n\t\t\tTriggerEvents = wasTriggering;\n\t\t}\n\t}\n}"
  },
  {
    "path": "Assets/Code/Bon/Graph.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0e28cabdc78f14b7e9bedf19aa6d2dc9\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Interface/IColorSampler.cs",
    "content": "﻿using Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Interface\n{\n\tpublic interface IColorSampler\n\t{\n\t\tColor GetColor(OutputSocket socket, float i);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Interface/IColorSampler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 05d81a07cc9eb4cb18cde73b2154e05e\ntimeCreated: 1471446464\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Interface/INumberSampler.cs",
    "content": "﻿using Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Interface\n{\n\tpublic interface INumberSampler\n\t{\n\t\tfloat GetNumber(OutputSocket outSocket, float x, float y, float z, float seed);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Interface/INumberSampler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 02522c1480dbb432d9d377b5b267c58e\ntimeCreated: 1471446464\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Interface/IStringSampler.cs",
    "content": "﻿using Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Interface\n{\n\tpublic interface IStringSampler\n\t{\n\t\tstring GetString(OutputSocket outSocket);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Interface/IStringSampler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ffda6b20a656b460cb435ee80c159a89\ntimeCreated: 1470942429\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Interface/IUpdateable.cs",
    "content": "﻿namespace Assets.Code.Bon.Nodes\n{\n\tpublic interface IUpdateable\n\t{\n\t\tvoid Update();\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Interface/IUpdateable.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 00450e3ca18e14e319c92419862b7acf\ntimeCreated: 1469268176\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Interface/IVectorSampler.cs",
    "content": "﻿using System.Collections.Generic;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Interface\n{\n\tpublic interface IVectorSampler\n\t{\n\t\tList<Vector3> GetVector3List(OutputSocket outSocket, float x, float y, float z, float sizeX, float sizeY, float sizeZ, float seed);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Interface/IVectorSampler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 69ade1b14079f4bbaa129384c316d1bb\ntimeCreated: 1471446464\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Interface.meta",
    "content": "fileFormatVersion: 2\nguid: 642bc3bc6e6e94bcc9b737b06fc27eac\nfolderAsset: yes\ntimeCreated: 1466621268\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Log.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon;\nusing UnityEngine;\n\npublic static class Log  {\n\n\n\tpublic static void Info(String info)\n\t{\n\t\tif (BonConfig.LogLevel > 0)\n\t\t{\n\t\t\tDebug.Log(info);\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Log.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f91aaa8f65ae44387b65ffc6f5c6ea3b\ntimeCreated: 1471468296\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Node.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Net;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon\n{\n\n\tpublic abstract class Node : IUpdateable\n\t{\n \t\t[NonSerialized] public List<AbstractSocket> Sockets = new List<AbstractSocket>();\n\t\t[NonSerialized] public  int Id;\n\t\t[NonSerialized] public string Name;\n\t\t[NonSerialized] private Graph _parent;\n\n\t\t[NonSerialized] public Rect WindowRect;\n\t\t[NonSerialized] public int VisitCount = 0;\n\t\t[NonSerialized] public Rect ContentRect;\n\t\t[NonSerialized] public static int LastFocusedNodeId;\n\t\t[NonSerialized] public bool Resizable = true;\n\t\t[NonSerialized] public Rect ResizeArea;\n\t\t[NonSerialized] public float SocketTopOffsetInput;\n\t\t[NonSerialized] public float SocketTopOffsetOutput;\n\n\t\t[NonSerialized] public bool Collapsed;\n\t\t[NonSerialized] public float Height;\n\n\t\tprotected Node(int id, Graph parent)\n\t\t{\n\t\t\tResizeArea = new Rect();\n\t\t\tId = id;\n\t\t\t// default size\n\t\t\tWidth = 100;\n\t\t\tHeight = 100;\n\t\t\tName = GetNodeName(GetType());\n\t\t\t_parent = parent;\n\t\t}\n\n\t\tpublic int GetId()\n\t\t{\n\t\t\treturn Id;\n\t\t}\n\n\t\tpublic abstract void OnGUI();\n\n\t\tpublic abstract void Update();\n\n\t\tpublic virtual void OnSerialization(SerializableNode sNode)\n\t\t{\n\t\t\t// for overriding: gets called before this Node gets serialized\n\t\t}\n\n\t\tpublic virtual void OnDeserialization(SerializableNode sNode)\n\t\t{\n\t\t\t// for overriding: gets called after this Node has been deserialized\n\t\t}\n\n\t\t/// The x position of the node\n\t\tpublic float X\n\t\t{\n\t\t\tget { return WindowRect.x; }\n\t\t\tset { WindowRect.x = value; }\n\t\t}\n\n\t\t/// The y position of the node\n\t\tpublic float Y\n\t\t{\n\t\t\tget { return WindowRect.y; }\n\t\t\tset { WindowRect.y = value; }\n\t\t}\n\n\t\t/// The width of the node\n\t\tpublic float Width\n\t\t{\n\t\t\tget { return WindowRect.width; }\n\t\t\tset { WindowRect.width = value; }\n\t\t}\n\n\t\t/// <summary>Returns true if the node is focused.</summary>\n\t\t/// <returns>True if the node is focused.</returns>\n\t\tpublic bool HasFocus()\n\t\t{\n\t\t\treturn LastFocusedNodeId == Id;\n\t\t}\n\n\t\tpublic virtual void OnFocus()\n\t\t{\n\t\t\tif (_parent.TriggerEvents)\n\t\t\t{\n\t\t\t\tEventManager.TriggerOnFocusNode(_parent, this);\n\t\t\t}\n\t\t}\n\n\t\tpublic void Collapse()\n\t\t{\n\t\t\tWindowRect.Set(WindowRect.x, WindowRect.y, WindowRect.width, 18);\n\t\t\tCollapsed = true;\n\t\t}\n\n\t\tpublic void Expand()\n\t\t{\n\t\t\tWindowRect.Set(WindowRect.x, WindowRect.y, WindowRect.width, Height);\n\t\t\tCollapsed = false;\n\t\t\tUpdate();\n\t\t}\n\n\t\t/// <summary>Returns true if this assigned position intersects the node.</summary>\n\t\t/// <param name=\"canvasPosition\">The position in canvas coordinates.</param>\n\t\t/// <returns>True if this assigned position intersects the node.</returns>\n\t\tpublic bool Intersects(Vector2 canvasPosition)\n\t\t{\n\t\t\treturn WindowRect.Contains(canvasPosition);\n\t\t}\n\n\t\t/// <summary> Returns true if this node contains the assigned socket.</summary>\n\t\t/// <param name=\"socket\"> The socket to use.</param>\n\t\t/// <returns>True if this node contains the assigned socket.</returns>\n\t\tpublic bool ContainsSocket(AbstractSocket socket)\n\t\t{\n\t\t\treturn Sockets.Contains(socket);\n\t\t}\n\n\t\tpublic int GetInputSocketCount()\n\t\t{\n\t\t\tvar count = 0;\n\t\t\tforeach (var socket in Sockets) if (socket.IsInput()) count++;\n\t\t\treturn count;\n\t\t}\n\n\t\t// TODO update docu\n\t\t/// <summary> Returns the socket of the type and index.</summary>\n\t\t/// <param name=\"type\"> The type of the socket.</param>\n\t\t/// <param name=\"direction\"> The input or output direction of the socket.</param>\n\t\t/// <param name=\"index\"> The index of sockets of this type.\n\t\t/// You can have multiple sockets of the same type.</param>\n\t\t/// <returns>The socket of the type with the index or null.</returns>\n\t\tpublic AbstractSocket GetSocket(Type edgeType, Type socketType, int index)\n\t\t{\n\t\t\tvar searchIndex = -1;\n\t\t\tforeach (var socket in Sockets)\n\t\t\t{\n\t\t\t\tif (socket.Type == edgeType && socket.GetType() == socketType)\n\t\t\t\t{\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\tif (searchIndex == index) return socket;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\t/// <summary>Projects the assigned position to a node relative position.</summary>\n\t\t/// <param name=\"canvasPosition\">The position in canvas coordinates.</param>\n\t\t/// <returns>The position in node coordinates</returns>\n\t\tpublic Vector2 ProjectToNode(Vector2 canvasPosition)\n\t\t{\n\t\t\tcanvasPosition.Set(canvasPosition.x - WindowRect.x, canvasPosition.y - WindowRect.y);\n\t\t\treturn canvasPosition;\n\t\t}\n\n\t\t/// <summary> Searches for a socket that intesects the assigned position.</summary>\n\t\t/// <param name=\"canvasPosition\">The position for intersection in canvas coordinates.</param>\n\t\t/// <returns>The at the position or null.</returns>\n\t\tpublic AbstractSocket SearchSocketAt(Vector2 canvasPosition)\n\t\t{\n\t\t\t//Vector2 nodePosition = ProjectToNode(canvasPosition);\n\t\t\tforeach (var socket in Sockets)\n\t\t\t{\n\t\t\t\tif (socket.Intersects(canvasPosition)) return socket;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\t/// <summary> Triggers the OnChangedNode event from within a Node.\n\t\t/// Call this method if your nodes content has changed. </summary>\n\t\tpublic void TriggerChangeEvent()\n\t\t{\n\t\t\tif (_parent.TriggerEvents)\n\t\t\t{\n\t\t\t\tEventManager.TriggerOnChangedNode(_parent, this);\n\t\t\t}\n\t\t}\n\n\t\t/// <summary> Returns true if all input Sockets are connected.</summary>\n\t\t/// <returns> True if all input Sockets are connected.</returns>\n\t\tpublic bool AllInputSocketsConnected()\n\t\t{\n\t\t\tforeach (var socket in Sockets)\n\t\t\t{\n\t\t\t\tif (!socket.IsConnected() && socket.IsInput()) return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t/// <summary> Returns the total number of input edges connected into this node.</summary>\n\t\tpublic int GetConnectedInputCount() {\n\t\t\tint count = 0;\n\t\t\tforeach (var socket in Sockets) \n\t\t\t{\n\t\t\t\tif (socket.IsInput () && socket.IsConnected ()) \n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn count;\n\t\t}\n\n\n\t\tpublic void GUIDrawSockets()\n\t\t{\n\t\t\tif (!Collapsed) foreach (var socket in Sockets) socket.Draw();\n\t\t}\n\n\t\tpublic void GUIDrawEdges()\n\t\t{\n\t\t\tforeach (var socket in Sockets)\n\t\t\t{\n\t\t\t\tif (socket.IsInput()) // draw only input sockets to avoid double drawing of edges\n\t\t\t\t{\n\t\t\t\t\tInputSocket inputSocket = (InputSocket) socket;\n\t\t\t\t\tif (inputSocket.IsConnected()) inputSocket.Edge.Draw();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/// <summary> Aligns the position of the sockets of this node </summary>\n\t\tpublic void GUIAlignSockets()\n\t\t{\n\t\t\tvar leftCount = 0;\n\t\t\tvar rightCount = 0;\n\t\t\tforeach (var socket in Sockets)\n\t\t\t{\n\t\t\t\tif (socket.IsInput())\n\t\t\t\t{\n\t\t\t\t\tsocket.X = - BonConfig.SocketSize + WindowRect.x;\n\t\t\t\t\tsocket.Y = GUICalcSocketTopOffset(leftCount) + WindowRect.y + SocketTopOffsetInput;\n\t\t\t\t\tleftCount++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsocket.X = WindowRect.width + WindowRect.x;\n\t\t\t\t\tsocket.Y = GUICalcSocketTopOffset(rightCount) + WindowRect.y + SocketTopOffsetOutput;\n\t\t\t\t\trightCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/// <summary> Calculates the offset of a socket from the top of this node </summary>\n\t\tprivate int GUICalcSocketTopOffset(int socketTopIndex)\n\t\t{\n\t\t\treturn BonConfig.SocketOffsetTop + (socketTopIndex*BonConfig.SocketSize)\n\t\t\t\t+ (socketTopIndex*BonConfig.SocketMargin);\n\t\t}\n\n\t\t/// <summary> Gets the menu entry name of this node </summary>\n\t\tpublic static string GetNodeName(Type nodeType)\n\t\t{\n\t\t\tobject[] attrs = nodeType.GetCustomAttributes(typeof(GraphContextMenuItem), true);\n\t\t\tGraphContextMenuItem attr = (GraphContextMenuItem) attrs[0];\n\t\t\treturn string.IsNullOrEmpty(attr.Name) ? nodeType.Name : attr.Name;\n\t\t}\n\n\t\t/// <summary> Gets the menu entry path of this node </summary>\n\t\tpublic static string GetNodePath(Type nodeType)\n\t\t{\n\t\t\tobject[] attrs = nodeType.GetCustomAttributes(typeof(GraphContextMenuItem), true);\n\t\t\tGraphContextMenuItem attr = (GraphContextMenuItem) attrs[0];\n\t\t\treturn string.IsNullOrEmpty(attr.Path) ? null : attr.Path;\n\t\t}\n\n\t\t/// <summary> Converts this node to a SerializableNode </summary>\n\t\tpublic SerializableNode ToSerializedNode()\n\t\t{\n\t\t\tSerializableNode n = new SerializableNode();\n\t\t\tn.type = GetType().FullName;\n\t\t\tn.id = Id;\n\t\t\tn.X = WindowRect.xMin;\n\t\t\tn.Y = WindowRect.yMin;\n\t\t\tn.Collapsed = Collapsed;\n\t\t\tn.directInputValues = new float[Sockets.Count];\n\n\t\t\tfor (var i = 0; i < n.directInputValues.Length; i++)\n\t\t\t{\n\t\t\t\tif (Sockets[i].IsInput())\n\t\t\t\t{\n\t\t\t\t\tInputSocket inputSocket = (InputSocket) Sockets[i];\n\t\t\t\t\tif (inputSocket.IsInDirectInputMode()) n.directInputValues[i] = inputSocket.GetDirectInputNumber();\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tn.data = JsonUtility.ToJson(this); // custom node data can be used\n\t\t\tOnSerialization(n);\n\t\t\treturn n;\n\t\t}\n\n\t\tpublic static Color GetEdgeColor(Type nodeType)\n\t\t{\n\t\t\tif (nodeType == typeof(AbstractNumberNode)) return new Color(0.32f, 0.58f, 0.86f, 1);\n\t\t\tif (nodeType == typeof(AbstractColorNode)) return new Color(0.54f, 0.70f, 0.50f, 1);\n\t\t\tif (nodeType == typeof(AbstractStringNode)) return new Color(0.84f, 0.45f, 0.39f, 1f);\n\t\t\tif (nodeType == typeof(AbstractVector3Node)) return new Color(0.9f, 0.9f, 0.9f, 1f);\n\t\t\treturn Color.black;\n\t\t}\n\t}\n\n\t/// <summary> A class to serialize a Node.</summary>\n\t[Serializable] public class SerializableNode\n\t{\n\t\t[SerializeField] public string type;\n\t\t[SerializeField] public int id;\n\t\t[SerializeField] public float X;\n\t\t[SerializeField] public float Y;\n\t\t[SerializeField] public string data;\n\t\t[SerializeField] public float[] directInputValues;\n\t\t[SerializeField] public bool Collapsed;\n\t}\n\n\t/// <summary> Annotation to register menu entries of Nodes to the editor.</summary>\n\t[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]\n\tpublic sealed class GraphContextMenuItem : Attribute\n\t{\n\t\tprivate  string _menuPath;\n\t\tpublic string Path { get { return _menuPath; } }\n\n\t\tprivate  string _itemName;\n\t\tpublic string Name { get { return _itemName; } }\n\n\t\tpublic GraphContextMenuItem(string menuPath) : this(menuPath, null)\n\t\t{\n\t\t}\n\n\t\tpublic GraphContextMenuItem(string menuPath, string itemName)\n\t\t{\n\t\t\t_menuPath = menuPath;\n\t\t\t_itemName = itemName;\n\t\t}\n\t}\n\n\n\n}\n\n\n"
  },
  {
    "path": "Assets/Code/Bon/Node.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 228028896bc3f44bfb3474a8fb5f4aff\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/AbstractColorNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Nodes\n{\n\tpublic abstract class AbstractColorNode : Node, IColorSampler\n\t{\n\n\t\tprotected AbstractColorNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\n\t\t}\n\n\t\tpublic abstract UnityEngine.Color GetColor(OutputSocket socket, float i);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/AbstractColorNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0637e900d20f9442590599bbb8656643\ntimeCreated: 1470915819\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/AbstractNumberNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Nodes\n{\n\tpublic abstract class AbstractNumberNode : Node, INumberSampler\n\t{\n\n\t\t[NonSerialized] protected OutputSocket _outSocket;\n\n\t\tprotected AbstractNumberNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_outSocket = new OutputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_outSocket);\n\t\t}\n\n\t\tpublic abstract float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed);\n\n\t\tpublic static float GetInputNumber(InputSocket socket, float x, float y, float z, float seed)\n\t\t{\n\t\t\tif (socket.Type != typeof(AbstractNumberNode)) return float.NaN;\n\t\t\tif (socket.IsInDirectInputMode()) return socket.GetDirectInputNumber();\n\n\t\t\tAbstractNumberNode node = (AbstractNumberNode) socket.GetConnectedSocket().Parent;\n\t\t\treturn node.GetNumber(socket.GetConnectedSocket(), x, y, z, seed);\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/AbstractNumberNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 29886bc40d47c421da789822a4be51cb\ntimeCreated: 1470915819\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/AbstractStringNode.cs",
    "content": "﻿using Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Nodes\n{\n\tpublic abstract class AbstractStringNode : Node, IStringSampler {\n\n\t\tprotected AbstractStringNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t}\n\n\t\tpublic abstract string GetString(OutputSocket outSocket);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/AbstractStringNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 542a024ba83a446eb9f634fced8e4ace\ntimeCreated: 1470940991\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/AbstractVector3Node.cs",
    "content": "﻿using System.Collections.Generic;\nusing Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Nodes\n{\n\tpublic abstract class AbstractVector3Node : Node, IVectorSampler\n\t{\n\t\tprotected AbstractVector3Node(int id, Graph parent) : base(id, parent)\n\t\t{\n\n\t\t}\n\n\t\tpublic static List<UnityEngine.Vector3> GetInputVector3List(InputSocket socket, float x, float y, float z,\n\t\t\tfloat sizeX, float sizeY, float sizeZ, float seed)\n\t\t{\n\t\t\tif (socket.Type != typeof(AbstractVector3Node) || !socket.CanGetResult()) return null;\n\t\t\tAbstractVector3Node node = (AbstractVector3Node) socket.GetConnectedSocket().Parent;\n\t\t\treturn node.GetVector3List(socket.GetConnectedSocket(), x, y, z, sizeX, sizeY, sizeZ, seed);\n\t\t}\n\n\t\tpublic abstract List<UnityEngine.Vector3> GetVector3List(OutputSocket socket, float x, float y, float z, float sizeX, float sizeY, float sizeZ, float seed);\n\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/AbstractVector3Node.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 9b0299a938d244da3bad3c657518b184\ntimeCreated: 1471356154\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Color/ColorNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing JetBrains.Annotations;\nusing UnityEngine;\nusing UnityEngine.UI;\n\nnamespace Assets.Code.Bon.Nodes.Color\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Color\", \"Color\")]\n\tpublic class ColorNode : AbstractColorNode\n\t{\n\t\t[SerializeField] private UnityEngine.Color _color;\n\n\t\t[NonSerialized] private InputSocket _inputSocketR;\n\t\t[NonSerialized] private InputSocket _inputSocketG;\n\t\t[NonSerialized] private InputSocket _inputSocketB;\n\t\t[NonSerialized] private InputSocket _inputSocketA;\n\n\t\t[NonSerialized] private Rect _labelR;\n\t\t[NonSerialized] private Rect _labelG;\n\t\t[NonSerialized] private Rect _labelB;\n\t\t[NonSerialized] private Rect _labelA;\n\n\t\t[NonSerialized] private Rect _sliderR;\n\t\t[NonSerialized] private Rect _sliderG;\n\t\t[NonSerialized] private Rect _sliderB;\n\t\t[NonSerialized] private Rect _sliderA;\n\n\t\tpublic ColorNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_labelR = new Rect(3, 0, 20, 20);\n\t\t\t_labelG = new Rect(3, 20, 20, 20);\n\t\t\t_labelB = new Rect(3, 40, 20, 20);\n\t\t\t_labelA = new Rect(3, 60, 20, 20);\n\n\t\t\t_sliderR = new Rect(23, 0, 50, 20);\n\t\t\t_sliderG = new Rect(23, 20, 50, 20);\n\t\t\t_sliderB = new Rect(23, 40, 50, 20);\n\t\t\t_sliderA = new Rect(23, 60, 50, 20);\n\n\t\t\t_inputSocketR = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocketG = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocketB = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocketA = new InputSocket(this, typeof(AbstractNumberNode));\n\n\t\t\tSockets.Add(_inputSocketR);\n\t\t\tSockets.Add(_inputSocketG);\n\t\t\tSockets.Add(_inputSocketB);\n\t\t\tSockets.Add(_inputSocketA);\n\n\t\t\tSockets.Add(new OutputSocket(this, typeof(AbstractColorNode)));\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tvar r = _color.r;\n\t\t\tvar g = _color.g;\n\t\t\tvar b = _color.b;\n\t\t\tvar a = _color.a;\n\n\t\t\tGUI.Label(_labelR, \"r\");\n\t\t\tGUI.Label(_labelG, \"g\");\n\t\t\tGUI.Label(_labelB, \"b\");\n\t\t\tGUI.Label(_labelA, \"a\");\n\n\t\t\tr = GUI.HorizontalSlider(_sliderR, r, 0f, 1f);\n\t\t\tg = GUI.HorizontalSlider(_sliderG, g, 0f, 1f);\n\t\t\tb = GUI.HorizontalSlider(_sliderB, b, 0f, 1f);\n\t\t\ta = GUI.HorizontalSlider(_sliderA, a, 0f, 1f);\n\n\t\t\tvar rChanged = UpdateDirectInput(_inputSocketR, _color.r, r);\n\t\t\tvar gChanged = UpdateDirectInput(_inputSocketG, _color.g, g);\n\t\t\tvar bChanged = UpdateDirectInput(_inputSocketB, _color.b, b);\n\t\t\tvar aChanged = UpdateDirectInput(_inputSocketA, _color.a, a);\n\n\t\t\tif (rChanged || gChanged || bChanged || aChanged)\n\t\t\t{\n\t\t\t\tSetColor(r, g, b, a);\n\t\t\t\tTriggerChangeEvent();\n\t\t\t}\n\n\t\t\tNodeUtils.GUIDrawRect(new Rect(77, 0, 20, 20), _color);\n\t\t}\n\n\t\tprivate bool UpdateDirectInput(InputSocket socket, float oldValue, float newValue)\n\t\t{\n\t\t\tif (oldValue != newValue && socket.IsInDirectInputMode())\n\t\t\t{\n\t\t\t\tsocket.SetDirectInputNumber(newValue, false);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tprivate void SetColor(float r, float g, float b, float a)\n\t\t{\n\t\t\t_color.r = r;\n\t\t\t_color.g = g;\n\t\t\t_color.b = b;\n\t\t\t_color.a = a;\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\t\t\t_color.r = AbstractNumberNode.GetInputNumber(_inputSocketR, 0, 0, 0, 0);\n\t\t\t_color.g = AbstractNumberNode.GetInputNumber(_inputSocketG, 0, 0, 0, 0);\n\t\t\t_color.b = AbstractNumberNode.GetInputNumber(_inputSocketB, 0, 0, 0, 0);\n\t\t\t_color.a = AbstractNumberNode.GetInputNumber(_inputSocketA, 0, 0, 0, 0);\n\t\t}\n\n\t\tpublic override UnityEngine.Color GetColor(OutputSocket outSocket, float i)\n\t\t{\n\t\t\treturn _color;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Color/ColorNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: eafd120e1858e44a592ecaf1fc1ee36b\ntimeCreated: 1470918712\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Color/GradientNode.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Color\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Color\", \"Gradient\")]\n\tpublic class GradientNode : AbstractColorNode\n\t{\n\n\t\t[SerializeField] private List<float> _times = new List<float>();\n\n\t\t[NonSerialized] private Rect _tmpRect;\n\t\t[NonSerialized] private Rect _addColorButton;\n\n\t\t[NonSerialized] private  List<InputSocket> _inputSockets;\n\t\t[NonSerialized] private Gradient _gradient;\n\t\t[NonSerialized] private Texture2D _previewTexture;\n\t\t[NonSerialized] private bool _needsUpdate = true;\n\n\t\tpublic GradientNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_inputSockets = new List<InputSocket>();\n\t\t\t_tmpRect = new Rect();\n\t\t\t_addColorButton = new Rect();\n\t\t\t_gradient = new Gradient();\n\t\t\tSockets.Add(new OutputSocket(this, typeof(AbstractColorNode)));\n\t\t\tWidth = 156;\n\t\t}\n\n\t\tpublic override void OnDeserialization(SerializableNode sNode)\n\t\t{\n\t\t\tvar aditionalSocketsCount = _times.Count;\n\t\t\twhile (Sockets.Count <= aditionalSocketsCount) AddInputSocket(false);\n\t\t}\n\n\t\tprivate void AddInputSocket(bool addTimes)\n\t\t{\n\t\t\tInputSocket s = new InputSocket(this, typeof(AbstractColorNode));\n\t\t\tSockets.Add(s);\n\t\t\t_inputSockets.Add(s);\n\t\t\tif (addTimes) _times.Add(0);\n\t\t\t_needsUpdate = true;\n\t\t}\n\n\t\tprivate void RemoveInputSocket(int i)\n\t\t{\n\t\t\tSockets.Remove(_inputSockets[i]);\n\t\t\t_inputSockets.Remove(_inputSockets[i]);\n\t\t\t_times.RemoveAt(i);\n\t\t\t_needsUpdate = true;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tHeight = _times.Count * 20 + 45;\n\n\t\t\t_addColorButton.Set(28, Height - 42, 100, 18);\n\t\t\tif (GUI.Button(_addColorButton, \"add color\")) AddInputSocket(true);\n\n\t\t\tvar socketToRemove = -1;\n\n\t\t\tfor (var i = 0; i < _inputSockets.Count; i++)\n\t\t\t{\n\t\t\t\t_tmpRect.Set(25, 20 * i, 100, 20);\n\n\t\t\t\tvar value = _times[i];\n\t\t\t\t_times[i] = GUI.HorizontalSlider(_tmpRect, value, 0f, 1f);\n\t\t\t\tif (Math.Abs(_times[i] - value) > 0.0001f) UpdateColorPreview();\n\t\t\t\t_tmpRect.Set(3, (20 * i) - 2, 18, 18);\n\t\t\t\tif (!_inputSockets[i].IsConnected()) if (GUI.Button(_tmpRect, \"x\")) socketToRemove = i;\n\t\t\t}\n\n\t\t\tif (_previewTexture != null)\n\t\t\t{\n\t\t\t\tGUI.DrawTexture(new Rect(Width - _previewTexture.width - 6, 0, _previewTexture.width, _previewTexture.height), _previewTexture);\n\t\t\t}\n\n\t\t\tif (socketToRemove != -1) RemoveInputSocket(socketToRemove);\n\n\t\t\tif (_needsUpdate) UpdateColorPreview();\n\t\t}\n\n\t\tpublic void UpdateColorPreview()\n\t\t{\n\t\t\t_needsUpdate = false;\n\t\t\tUpdateGradient();\n\t\t\tif (_previewTexture != null) Texture2D.DestroyImmediate(_previewTexture);\n\t\t\t_previewTexture = new Texture2D(20, (int) Height - 24);\n\n\t\t\tfor (int y = 0; y < _previewTexture.height; y++)\n\t\t\t{\n\t\t\t\tUnityEngine.Color c = _gradient.Evaluate(y / (float) _previewTexture.height);\n\t\t\t\tfor (int x = 0; x < _previewTexture.width; x++)\n\t\t\t\t{\n\t\t\t\t\t_previewTexture.SetPixel(x, y, c);\n\t\t\t\t}\n\t\t\t}\n\t\t\t_previewTexture.Apply();\n\t\t}\n\n\t\tprivate void UpdateGradient()\n\t\t{\n\t\t\tGradientColorKey[] colorKeys = new GradientColorKey[_inputSockets.Count];\n\t\t\tGradientAlphaKey[] alphaKeys = new GradientAlphaKey[_inputSockets.Count];\n\t\t\tfor (int i = 0; i < _inputSockets.Count; i++)\n\t\t\t{\n\t\t\t\tUnityEngine.Color c = UnityEngine.Color.black;\n\t\t\t\tif (_inputSockets[i].IsConnected())\n\t\t\t\t{\n\t\t\t\t\tAbstractColorNode colorNode = (AbstractColorNode) _inputSockets[i].GetConnectedSocket().Parent;\n\t\t\t\t\tc = colorNode.GetColor(_inputSockets[i].GetConnectedSocket(), 0);\n\t\t\t\t}\n\t\t\t\tcolorKeys[i] = new GradientColorKey();\n\t\t\t\tcolorKeys[i].color = c;\n\t\t\t\tcolorKeys[i].time = _times[i];\n\t\t\t\talphaKeys[i] = new GradientAlphaKey();\n\t\t\t\talphaKeys[i].alpha = c.a;\n\t\t\t\talphaKeys[i].time = _times[i];\n\t\t\t}\n\t\t\t_gradient.SetKeys(colorKeys, alphaKeys);\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\t\t\tif (!Collapsed)\n\t\t\tUpdateColorPreview();\n\t\t}\n\n\t\tpublic override UnityEngine.Color GetColor(OutputSocket outSocket, float i)\n\t\t{\n\t\t\treturn _gradient.Evaluate(i);\n\t\t}\n\n\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Color/GradientNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 614d79690b0534b2986db342ac1fd827\ntimeCreated: 1470915115\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Color.meta",
    "content": "fileFormatVersion: 2\nguid: c7b7935ebcbd14e3a9984a6763ec229d\nfolderAsset: yes\ntimeCreated: 1470915086\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Geometry/LandscapeNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Geometry\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Geometry\", \"Lanscape\")]\n\tpublic class LandscapeNode : AbstractNumberNode, IColorSampler, IStringSampler {\n\n\t\t[NonSerialized] private Rect _heightValueLabel;\n\t\t[NonSerialized] private Rect _colorRangeLabel;\n\t\t[NonSerialized] private Rect _materialLabel;\n\n\t\t[NonSerialized] private InputSocket _heightValueSocket;\n\t\t[NonSerialized] private InputSocket _gradientSocket;\n\t\t[NonSerialized] private InputSocket _materialSocket;\n\n\t\tpublic LandscapeNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_heightValueLabel = new Rect(8, 0, 75, 20);\n\t\t\t_colorRangeLabel = new Rect(8, 20, 75, 20);\n\t\t\t_materialLabel = new Rect(8, 40, 75, 20);\n\n\t\t\t_heightValueSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_heightValueSocket);\n\t\t\t_gradientSocket = new InputSocket(this, typeof(AbstractColorNode));\n\t\t\tSockets.Add(_gradientSocket);\n\t\t\t_materialSocket = new InputSocket(this, typeof(AbstractStringNode));\n\t\t\tSockets.Add(_materialSocket);\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tGUI.Label(_heightValueLabel, \"height map\");\n\t\t\tGUI.Label(_colorRangeLabel, \"vertex color\");\n\t\t\tGUI.Label(_materialLabel, \"material\");\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket socket, float x, float y, float z, float seed)\n\t\t{\n\t\t\treturn GetInputNumber(_heightValueSocket, x, y, z, seed);\n\t\t}\n\n\t\tpublic UnityEngine.Color GetColorFrom(float i)\n\t\t{\n\t\t\tif (!_gradientSocket.IsConnected()) return UnityEngine.Color.black;\n\t\t\tAbstractColorNode node = (AbstractColorNode) _gradientSocket.GetConnectedSocket().Parent;\n\t\t\treturn node.GetColor(_gradientSocket.GetConnectedSocket(), i);\n\t\t}\n\n\t\tpublic string GetString()\n\t\t{\n\t\t\tif (!_materialSocket.IsConnected()) return \"\";\n\t\t\tAbstractStringNode node = (AbstractStringNode) _materialSocket.GetConnectedSocket().Parent;\n\t\t\treturn node.GetString(_materialSocket.GetConnectedSocket());\n\t\t}\n\n\t\tpublic UnityEngine.Color GetColor(OutputSocket outSocket, float i)\n\t\t{\n\t\t\treturn UnityEngine.Color.black;\n\t\t}\n\n\t\tpublic string GetString(OutputSocket outSocket)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Geometry/LandscapeNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 010d5a0994b59428e8856c666f4bc08b\ntimeCreated: 1471434156\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Geometry/ModelNode.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\n[Serializable]\n[GraphContextMenuItem(\"Geometry\", \"Model\")]\npublic class ModelNode : Node\n{\n\tprivate InputSocket _inputSocketPosition;\n\tprivate InputSocket _inputSocketRotation;\n\tprivate InputSocket _inputSocketScale;\n\tprivate InputSocket _inputSocketModelName;\n\n\tprivate Rect _tmpRect;\n\n\tpublic ModelNode(int id, Graph parent) : base(id, parent)\n\t{\n\t\t_inputSocketPosition = new InputSocket(this, typeof(AbstractVector3Node));\n\t\t_inputSocketRotation = new InputSocket(this, typeof(AbstractVector3Node));\n\t\t_inputSocketScale = new InputSocket(this, typeof(AbstractVector3Node));\n\t\t_inputSocketModelName = new InputSocket(this, typeof(AbstractStringNode));\n\n\t\tSockets.Add(_inputSocketModelName);\n\t\tSockets.Add(_inputSocketPosition);\n\t\tSockets.Add(_inputSocketRotation);\n\t\tSockets.Add(_inputSocketScale);\n\n\t\tHeight = 100;\n\t\t_tmpRect = new Rect();\n\t}\n\n\tpublic override void OnGUI()\n\t{\n\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t_tmpRect.Set(3, 0, 50, 20);\n\t\tGUI.Label(_tmpRect, \"file\");\n\n\t\t_tmpRect.Set(3, 20, 50, 20);\n\t\tGUI.Label(_tmpRect, \"position\");\n\n\t\t_tmpRect.Set(3, 40, 50, 20);\n\t\tGUI.Label(_tmpRect, \"rotation\");\n\n\t\t_tmpRect.Set(3, 60, 50, 20);\n\t\tGUI.Label(_tmpRect, \"scale\");\n\n\t}\n\n\tpublic string GetModelFileName()\n\t{\n\t\tif (!_inputSocketModelName.CanGetResult()) return null;\n\t\treturn ((AbstractStringNode) _inputSocketModelName.GetConnectedSocket().Parent).GetString(_inputSocketModelName.GetConnectedSocket());\n\t}\n\n\tpublic List<Vector3> GetPositions(float x, float y, float z, float sizeX, float sizeY, float sizeZ, float seed)\n\t{\n\t\tif (!_inputSocketPosition.CanGetResult()) return null;\n\t\treturn AbstractVector3Node.GetInputVector3List(_inputSocketPosition, x, y, z, sizeX, sizeY, sizeZ, seed);\n\t}\n\n\tpublic override void Update()\n\t{\n\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Geometry/ModelNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 46ccb94ed99294a72abd4353ea24d7a2\ntimeCreated: 1471434184\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Geometry.meta",
    "content": "fileFormatVersion: 2\nguid: b274c4e04e1c7472e811251c0c77eaa9\nfolderAsset: yes\ntimeCreated: 1470916750\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/NodeUtils.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Assets.Code.Bon.Interface;\n\npublic class NodeUtils {\n\n\tpublic const string NotConnectedMessage = \"not connected\";\n\tprivate static Texture2D _staticRectTexture;\n\tprivate static GUIStyle _staticRectStyle;\n\n\t/** Draws a textfield that accepts float inputs only.\n\t\tReturns true if the value has changed.\n\t**/\n\tpublic static bool FloatTextField(Rect area, ref string number)\n\t{\n\t\tif (number == null) return false;\n\t\tvar textFieldValue = GUI.TextField(area, number);\n\t\tvar newTextFieldValue = GetValidNumberString(textFieldValue, number);\n\t\tvar numberChanged = !IsEqualFloatValue(newTextFieldValue, number);\n\t\tnumber = newTextFieldValue;\n\t\treturn numberChanged;\n\t}\n\n\n\tpublic static string GetValidNumberString(string text, string defaultNumber)\n\t{\n\t\tif (text == \"\") text = \"0\";\n\t\tif (Regex.Match(text, @\"^-?[0-9]*(?:\\.[0-9]*)?$\").Success) return text;\n\t\treturn defaultNumber;\n\t}\n\n\tpublic static bool IsEqualFloatValue(string number01, string number02)\n\t{\n\t\treturn !(System.Math.Abs(float.Parse(number01) - float.Parse(number02)) > 0);\n\t}\n\n\tpublic static Color GetMapValueColor(float value)\n\t{\n\t\tif (float.IsNaN(value)) return Color.magenta;\n\t\tif (value > 1f) return Color.red;\n\t\tif (value < -1f) return Color.blue;\n\t\tColor c = Color.white * (value + 1f) / 2f;\n\t\tc.a = 1;\n\t\treturn c;\n\t}\n\n\n\tpublic static Color[] ToColorMap(float[,] values, IColorSampler colorSampler = null)\n\t{\n\t\tint width = values.GetLength(0);\n\t\tint height = values.GetLength(1);\n\t\tColor[] colorMap = new Color[width * height];\n\t\tfor (int y = 0; y < height; y++)\n\t\t{\n\t\t\tfor (int x = 0; x < width; x++)\n\t\t\t{\n\t\t\t\tColor c;\n\t\t\t\tif (colorSampler == null) c = GetMapValueColor(values[x, y]);\n\t\t\t\telse c = colorSampler.GetColor(null, (values[x, y] + 1f) / 2f);\n\t\t\t\tcolorMap[y * width + x] = c;\n\t\t\t}\n\t\t}\n\t\treturn colorMap;\n\t}\n\n\n\tpublic static void GUIDrawRect(Rect position, Color color )\n\t{\n\t\tif(_staticRectTexture == null) _staticRectTexture = new Texture2D( 1, 1 );\n\t\tif(_staticRectStyle == null) _staticRectStyle = new GUIStyle();\n\t\t_staticRectTexture.SetPixel(0, 0, color);\n\t\t_staticRectTexture.Apply();\n\t\t_staticRectStyle.normal.background = _staticRectTexture;\n\t\tGUI.Box( position, GUIContent.none, _staticRectStyle );\n\t}\n\n\tpublic static float ModifySeed(float baseSeed, float modifierSeed)\n\t{\n\t\tif (modifierSeed == 0) return baseSeed;\n\t\treturn baseSeed * modifierSeed % float.MaxValue;\n\t}\n\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/NodeUtils.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 719e086ad613e41e7bd9cb37ac794fe6\ntimeCreated: 1467725131\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/AbstractNoiseNode.cs",
    "content": "﻿using System.Collections.Generic;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Noise\n{\n\tpublic abstract class AbstractNoiseNode : AbstractNumberNode\n\t{\n\t\tprotected List<GUIThreadedTexture> _textures;\n\t\tprivate Rect _errorMessageLabel;\n\n\t\tprotected AbstractNoiseNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_errorMessageLabel = new Rect(3, 0, 100, 15);\n\t\t\t_textures = new List<GUIThreadedTexture>();\n\t\t}\n\n\n\t\tprotected void DrawTextures()\n\t\t{\n\n\t\t\tfor (var i = 0; i < _textures.Count; i++) _textures[i].OnGUI();\n\t\t\t//if (!CanCreatePreview()) GUI.Label(_errorMessageLabel, NodeUtils.NotConnectedMessage);\n\n\n\t\t\tif (IsUpdatingTexture()) GUI.Label(_errorMessageLabel, \"updating data..\");\n\t\t}\n\n\t\tprotected bool IsUpdatingTexture()\n\t\t{\n\t\t\tforeach (GUIThreadedTexture t in _textures) if (t.IsUpdating) return true;\n\t\t\treturn false;\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/AbstractNoiseNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 85fe2ca50750244c0846c24de6db5735\ntimeCreated: 1471356475\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/NoiseDisplayNode.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Nodes.Number;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Noise\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Noise\", \"Display\")]\n\tpublic class NoiseDisplayNode : AbstractNoiseNode\n\t{\n\t\t[SerializeField] private int _sizeModifcator;\n\n\t\t[NonSerialized] private InputSocket _inputSocketNumber;\n\t\t[NonSerialized] private InputSocket _inputSocketColor;\n\t\t[NonSerialized] private InputSocket _inputSocketPosition;\n\n\t\t[NonSerialized] private Rect _sizeLabel;\n\t\t[NonSerialized] private Rect _sizePlusButton;\n\t\t[NonSerialized] private Rect _sizeMinusButton;\n\n\t\t[NonSerialized] private const int _sizeStep = 50;\n\n\t\tprivate List<UnityEngine.Vector3> _lastVectors;\n\n\t\tprivate bool _initializedSize;\n\t\tprivate Rect _tmpRect;\n\n\t\tpublic NoiseDisplayNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_sizeLabel = new Rect(3, 0, 25, 15);\n\t\t\t_sizePlusButton = new Rect(28, 0, 18, 18);\n\t\t\t_sizeMinusButton = new Rect(46, 0, 18, 18);\n\n\t\t\t_inputSocketNumber = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocketNumber);\n\n\t\t\t_inputSocketColor = new InputSocket(this, typeof(AbstractColorNode));\n\t\t\tSockets.Add(_inputSocketColor);\n\n\t\t\t_inputSocketPosition = new InputSocket(this, typeof(AbstractVector3Node));\n\t\t\tSockets.Add(_inputSocketPosition);\n\n\t\t\t_textures.Add(new GUIThreadedTexture()); // heightmap\n\t\t\t_textures.Add(new GUIThreadedTexture()); // points\n\n\t\t\t_tmpRect = new Rect();\n\t\t\tWidth = 160;\n\t\t\tHeight = 220;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\n\t\t\tif (!_initializedSize) ChangeTextureSize(_sizeModifcator * _sizeStep);\n\n\t\t\tif (!_textures[0].DoneInitialUpdate) _textures[0].StartTextureUpdateJob((int) Width -10, (int) Height - 70, GetNumberSampler(), GetColorSampler());\n\t\t\tif (!_textures[1].DoneInitialUpdate) _textures[1].StartTextureUpdateJob((int) Width -10, (int) Height - 70, GetNumberSampler(), GetColorSampler());\n\n\t\t\tif (!IsUpdatingTexture())\n\t\t\t{\n\t\t\t\t_sizeLabel.Set(_sizeLabel.x, Height - 65, _sizeLabel.width, _sizeLabel.height);\n\t\t\t\t_sizePlusButton.Set(_sizePlusButton.x, Height - 65, _sizePlusButton.width, _sizePlusButton.height);\n\t\t\t\t_sizeMinusButton.Set(_sizeMinusButton.x, Height - 65, _sizeMinusButton.width, _sizeMinusButton.height);\n\n\t\t\t\tGUI.Label(_sizeLabel, \"size\");\n\t\t\t\tif (GUI.Button(_sizePlusButton, \"+\"))\n\t\t\t\t{\n\t\t\t\t\tChangeTextureSize(+_sizeStep);\n\t\t\t\t\t_sizeModifcator++;\n\t\t\t\t}\n\t\t\t\tif (Width > 100 && GUI.Button(_sizeMinusButton, \"-\"))\n\t\t\t\t{\n\t\t\t\t\tChangeTextureSize(-_sizeStep);\n\t\t\t\t\t_sizeModifcator--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tDrawTextures();\n\t\t\t//Width = CurrentTextureSize + 12;\n\t\t\t//Height = CurrentTextureSize + 50;\n\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t\t_tmpRect.Set(3, Height - 45, 100, 20);\n\t\t\tGUI.Label(_tmpRect, \"w\" + _textures[0].Width + \" h\" + _textures[0].Height);\n\n\t\t\tif (_lastVectors != null)\n\t\t\t{\n\t\t\t\t_tmpRect.Set(70, Height - 45, 100, 20);\n\t\t\t\tGUI.Label(_tmpRect, \"vec\" + _lastVectors.Count);\n\t\t\t}\n\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleCenter;\n\t\t}\n\n\t\tprivate void ChangeTextureSize(int size)\n\t\t{\n\t\t\t_initializedSize = true;\n\t\t\tWidth += size;\n\t\t\tHeight += size;\n\t\t\tUpdate();\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\t\t\tif (Collapsed) return;\n\n\t\t\tif (_inputSocketNumber.CanGetResult())\n\t\t\t\t_textures[0].StartTextureUpdateJob((int) Width -10, (int) Height - 70, GetNumberSampler(), GetColorSampler());\n\t\t\telse _textures[0].Hide();\n\n\n\t\t\tif (_inputSocketPosition.CanGetResult())\n\t\t\t{\n\t\t\t\t_lastVectors = GetPositionSampler().GetVector3List(\n\t\t\t\t\t_inputSocketPosition.GetConnectedSocket(),\n\t\t\t\t\t0, 0, 0, (int) Width - 10, 0, (int) Height - 70, 0);\n\t\t\t\t_textures[1].StartTextureUpdateJob((int) Width - 10, (int) Height - 70, _lastVectors);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t_textures[1].Hide();\n\t\t\t\t_lastVectors = null;\n\t\t\t}\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\treturn GetInputNumber(_inputSocketNumber, x, y, z, seed);\n\t\t}\n\n\t\tprivate IColorSampler GetColorSampler()\n\t\t{\n\t\t\tif (_inputSocketColor.CanGetResult()) return (AbstractColorNode) _inputSocketColor.GetConnectedSocket().Parent;\n\t\t\treturn null;\n\t\t}\n\n\t\tprivate INumberSampler GetNumberSampler()\n\t\t{\n\t\t\tif (_inputSocketNumber.IsInDirectInputMode()) return new SingleNumberSampler(GetInputNumber(_inputSocketNumber, 0, 0, 0, 0));\n\t\t\tif (_inputSocketNumber.CanGetResult()) return (AbstractNumberNode) _inputSocketNumber.GetConnectedSocket().Parent;\n\t\t\treturn null;\n\t\t}\n\n\t\tprivate IVectorSampler GetPositionSampler()\n\t\t{\n\t\t\tif (_inputSocketPosition.CanGetResult()) return (AbstractVector3Node) _inputSocketPosition.GetConnectedSocket().Parent;\n\t\t\treturn null;\n\t\t}\n\n\n\t}\n}\n\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/NoiseDisplayNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e416ebb05ca314aa6a56b85d2a2f862e\ntimeCreated: 1471356475\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/OctaveNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Noise\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Noise\", \"Octave\")]\n\tpublic class OctaveNode : AbstractNumberNode {\n\n\n\t\t[NonSerialized] private InputSocket _inputNoiseSocket;\n\t\t[NonSerialized] private InputSocket _inputIterationSocket;\n\t\t[NonSerialized] private InputSocket _inputLacunaritySocket;\n\t\t[NonSerialized] private InputSocket _inputPersistanceSocket;\n\n\t\t[NonSerialized] private Rect _labelNoise;\n\t\t[NonSerialized] private Rect _labelIteration;\n\t\t[NonSerialized] private Rect _labelLacunarity;\n\t\t[NonSerialized] private Rect _labelPersistance;\n\n\t\tpublic OctaveNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_labelNoise = new Rect(3, 0, 100, 20);\n\t\t\t_labelIteration = new Rect(3, 20, 100, 20);\n\t\t\t_labelLacunarity = new Rect(3, 40, 100, 20);\n\t\t\t_labelPersistance = new Rect(3, 60, 100, 20);\n\n\t\t\t_inputNoiseSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputIterationSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputLacunaritySocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputPersistanceSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\n\t\t\t_inputIterationSocket.SetDirectInputNumber(4, false);\n\t\t\t_inputLacunaritySocket.SetDirectInputNumber(3, false);\n\t\t\t_inputPersistanceSocket.SetDirectInputNumber(0.2f, false);\n\n\t\t\tSockets.Add(_inputNoiseSocket);\n\t\t\tSockets.Add(_inputIterationSocket);\n\t\t\tSockets.Add(_inputLacunaritySocket);\n\t\t\tSockets.Add(_inputPersistanceSocket);\n\t\t\tWidth = 100;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t\tGUI.Label(_labelNoise, \"noise\");\n\t\t\tGUI.Label(_labelIteration, \"iteration\");\n\t\t\tGUI.Label(_labelLacunarity, \"lacunarity\");\n\t\t\tGUI.Label(_labelPersistance, \"persistance\");\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleCenter;\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocker, float x, float y, float z, float seed)\n\t\t{\n\t\t\tvar iterations = GetInputNumber(_inputIterationSocket, x, y, z, seed);\n\t\t\tvar lacunarity = GetInputNumber(_inputLacunaritySocket, x, y, z, seed);\n\t\t\tvar persistance = GetInputNumber(_inputPersistanceSocket, x, y, z, seed);\n\n\t\t\tif (float.IsNaN(iterations) || float.IsNaN(lacunarity) || float.IsNaN(persistance)) return float.NaN;\n\n\t\t\tfloat noiseHeight = 0;\n\t\t\tvar frequency = 1f;\n\t\t\tvar amplitude = 1f;\n\n\t\t\tfor (var i = 0; i < (int) iterations; i++)\n\t\t\t{\n\t\t\t\tvar noise = GetInputNumber(_inputNoiseSocket, x * frequency, y * frequency, z * frequency, seed / (i + 1)) * 2 - 1;\n\t\t\t\tnoiseHeight += noise * amplitude;\n\t\t\t\tamplitude *= persistance;\n\t\t\t\tfrequency *= lacunarity;\n\t\t\t}\n\t\t\tnoiseHeight = (noiseHeight + 1f) / 2f;\n\t\t\treturn noiseHeight;\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/OctaveNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c18c70b602d3940c9a5d8315bde9f089\ntimeCreated: 1470915819\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/SineMapNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Noise\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Noise\", \"Sine\")]\n\tpublic class SineMapNode : AbstractNoiseNode {\n\n\n\t\t[NonSerialized] private Rect _textLabelScaleX;\n\t\t[NonSerialized] private Rect _textLabelScaleY;\n\n\t\t[NonSerialized] private InputSocket _socketInputX;\n\t\t[NonSerialized] private InputSocket _socketInputY;\n\n\t\tpublic SineMapNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_textLabelScaleX = new Rect(6, 0, 65, BonConfig.SocketSize);\n\t\t\t_textLabelScaleY = new Rect(6, 20, 65, BonConfig.SocketSize);\n\t\t\t_socketInputX = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_socketInputX);\n\t\t\t_socketInputY = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_socketInputY);\n\n\t\t\tHeight = 60;\n\t\t\t_textures.Add(new GUIThreadedTexture()); // heightmap\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tif (!_textures[0].DoneInitialUpdate) Update();\n\n\t\t\t_textures[0].X = 48;\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t\tGUI.Label(_textLabelScaleX, \"scale x\");\n\t\t\tGUI.Label(_textLabelScaleY, \"scale y\");\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleCenter;\n\t\t\tDrawTextures();\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\tvar scaleX = GetInputNumber(_socketInputX, x, y, z, seed);\n\t\t\tvar scaleZ = GetInputNumber(_socketInputY, x, y, z, seed);\n\n\t\t\tif (float.IsNaN(scaleX) || float.IsNaN(scaleZ)) return float.NaN;\n\n\t\t\tif (scaleX == 0) scaleX = 1;\n\t\t\tif (scaleZ == 0) scaleZ = 1;\n\n\t\t\treturn (float) (Math.Sin(x / scaleX + seed) + Math.Sin(y / scaleZ + seed)) / 2f;\n\t\t}\n\n\t\t/*protected override IColorSampler GetColorSampler()\n\t{\n\t\treturn null;\n\t}*/\n\n\t\tpublic override void Update()\n\t\t{\n\t\t\tif (!Collapsed) _textures[0].StartTextureUpdateJob(45, 35, this, null);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/SineMapNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: eb89bb942cd274369bfe14028e657525\ntimeCreated: 1470997476\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/Special.meta",
    "content": "fileFormatVersion: 2\nguid: f7f24f866023f4abe93e6f6e579862db\nfolderAsset: yes\ntimeCreated: 1470836112\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/TextureUpdateJob.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Nodes.Vector3;\nusing Assets.Code.Bon.Thread;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Noise\n{\n\tpublic class TextureUpdateJob : ThreadedJob\n\t{\n\n\t\tprivate INumberSampler _numberSampler;\n\t\tprivate IColorSampler _samplerColor;\n\t\tprivate List<UnityEngine.Vector3> _positions;\n\n\t\tprivate int _width;\n\t\tprivate int _height;\n\t\tprivate float[,] _values;\n\n\t\tpublic Texture2D Texture;\n\n\t\tpublic void Request(int width, int height, INumberSampler sampler, IColorSampler colorSampler = null)\n\t\t{\n\t\t\t_numberSampler = sampler;\n\t\t\t_samplerColor = colorSampler;\n\t\t\t_values = new float[width, height];\n\t\t\tInit(width, height);\n\t\t}\n\n\t\tpublic void Request(int width, int height, List<UnityEngine.Vector3> positions)\n\t\t{\n\t\t\t_positions = positions;\n\t\t\t_samplerColor = new Vector3DisplayColorSampler();\n\t\t\tInit(width, height);\n\t\t}\n\n\t\tprivate void Init(int width, int height)\n\t\t{\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\t}\n\n\t\tprotected override void ThreadFunction()\n\t\t{\n\t\t\tif (_numberSampler == null) return;\n\t\t\tvar _xStart = 0;\n\t\t\tvar _zStart = 0;\n\t\t\tfor (var x = _xStart; x < _xStart + _width; x++)\n\t\t\t{\n\t\t\t\tfor (var z = _zStart; z < _zStart + _height; z++)\n\t\t\t\t{\n\t\t\t\t\t_values[x - _xStart, z - _zStart] = _numberSampler.GetNumber(null, x, 0, z, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprotected override void OnFinished()\n\t\t{\n\t\t\tif (Texture != null) Texture2D.DestroyImmediate(Texture);\n\t\t\tTexture = new Texture2D(_width, _height, TextureFormat.RGBA32, false);\n\n\t\t\tif (_numberSampler != null) Texture.SetPixels(NodeUtils.ToColorMap(_values, _samplerColor));\n\t\t\telse if (_positions != null)\n\t\t\t{\n\t\t\t\tTexture.SetPixels(new UnityEngine.Color[_width * _height]);\n\t\t\t\tforeach (var position in _positions)\n\t\t\t\t{\n\t\t\t\t\tTexture.SetPixel((int) position.x, (int) position.z, UnityEngine.Color.white);\n\t\t\t\t}\n\t\t\t}\n\t\t\tTexture.Apply();\n\t\t}\n\n\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/TextureUpdateJob.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 49eb64574fe7248e9829aa9999d0701a\ntimeCreated: 1470838738\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/UnityPerlinNoiseNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Noise\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Noise\", \"UnityPerlinNoise\")]\n\tpublic class UnityPerlinNoiseNode : AbstractNoiseNode\n\t{\n\n\t\t[NonSerialized] private Rect _labelScale;\n\t\t[NonSerialized] private Rect _labelSeed;\n\n\t\t[NonSerialized] private InputSocket _inputSocketScale;\n\t\t[NonSerialized] private InputSocket _inputSocketSeed;\n\n\t\tpublic UnityPerlinNoiseNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_labelScale = new Rect(6, 0, 30, BonConfig.SocketSize);\n\t\t\t_labelSeed = new Rect(6, 20, 30, BonConfig.SocketSize);\n\t\t\t_inputSocketScale = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocketSeed = new InputSocket(this, typeof(AbstractNumberNode));\n\n\t\t\t_inputSocketScale.SetDirectInputNumber(5, false);\n\n\t\t\tSockets.Add(_inputSocketScale);\n\t\t\tSockets.Add(_inputSocketSeed);\n\n\t\t\t//Height = CurrentTextureSize + 70;\n\t\t\t_textures.Add(new GUIThreadedTexture()); // heightmap\n\t\t\tHeight = 60;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tif (!_textures[0].DoneInitialUpdate) Update();\n\n\t\t\t_textures[0].X = 40;\n\n\t\t\tGUI.Label(_labelScale, \"scale\");\n\t\t\tGUI.Label(_labelSeed, \"seed\");\n\t\t\tDrawTextures();\n\t\t}\n\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\tvar scale = GetInputNumber(_inputSocketScale, x, y, z, seed);\n\t\t\tvar socketSeed = GetInputNumber(_inputSocketSeed, x, y, z, seed);\n\n\t\t\tif (float.IsNaN(scale) || float.IsNaN(socketSeed)) return float.NaN;\n\n\t\t\tif (scale == 0) scale = 1;\n\n\t\t\tvar modifiedSeed = NodeUtils.ModifySeed(socketSeed, seed);\n\n\t\t\tfloat noise = Mathf.PerlinNoise(x / scale + modifiedSeed, z / scale + modifiedSeed) * 2f - 1f;\n\t\t\treturn Math.Max(Math.Min(noise, 1), -1);\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\t\t\tif (!Collapsed) _textures[0].StartTextureUpdateJob(55, 35, this, null);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise/UnityPerlinNoiseNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5b5ed417c5ae449e48a5b3c11c65ce24\ntimeCreated: 1471538687\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Noise.meta",
    "content": "fileFormatVersion: 2\nguid: ce22aaa2af7374dfe8a7e3ab6a7e5e6d\nfolderAsset: yes\ntimeCreated: 1471356267\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/AbsNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\n\n[Serializable]\n[GraphContextMenuItem(\"Number\", \"Abs\")]\npublic class AbsNode : AbstractNumberNode\n{\n\tprivate InputSocket _inputSocket;\n\n\tpublic AbsNode(int id, Graph parent) : base(id, parent)\n\t{\n\t\t_inputSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\tSockets.Add(_inputSocket);\n\t\tWidth = 40;\n\t\tHeight = 40;\n\t}\n\n\tpublic override void OnGUI()\n\t{\n\n\t}\n\n\tpublic override void Update()\n\t{\n\n\t}\n\n\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t{\n\t\tvar number = GetInputNumber(_inputSocket, x, y, z, seed);\n\t\tif (float.IsNaN(number)) return float.NaN;\n\t\treturn Math.Abs(number);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/AbsNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 29c4e4095930c4081a6e9d0ca760eed7\ntimeCreated: 1471020772\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/ConditionNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\n/**\n\tThis node avoids the evaluation of the graph branch that\n\twhere the condition is not true. This can be used to improves performance.\n**/\nnamespace Assets.Code.Bon.Nodes.Number\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Number\", \"Condition\")]\n\tpublic class ConditionNode : AbstractNumberNode\n\t{\n\n\t\t[NonSerialized] private Rect _labelInput01;\n\t\t[NonSerialized] private Rect _labelInput02;\n\t\t[NonSerialized] private Rect _labelCondition;\n\n\t\t[NonSerialized] private InputSocket _inputSocket01;\n\t\t[NonSerialized] private InputSocket _inputSocket02;\n\t\t[NonSerialized] private InputSocket _conditionSocket;\n\n\t\tpublic ConditionNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_labelInput01 = new Rect(3, 0, 100, 20);\n\t\t\t_labelInput02 = new Rect(3, 20, 100, 20);\n\t\t\t_labelCondition = new Rect(3, 40, 100, 20);\n\n\t\t\t_inputSocket01 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocket02 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_conditionSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocket01);\n\t\t\tSockets.Add(_inputSocket02);\n\t\t\tSockets.Add(_conditionSocket);\n\t\t\tSockets.Add(_outSocket);\n\t\t\tHeight = 80;\n\t\t\tWidth = 80;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tGUI.Label(_labelInput01, \"if (x < 0.0)\");\n\t\t\tGUI.Label(_labelInput02, \"if (x >= 0.0)\");\n\t\t\tGUI.Label(_labelCondition, \"x\");\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\tvar conditionValue02 = GetInputNumber(_conditionSocket, x, y, z, seed);\n\t\t\tif (float.IsNaN(conditionValue02)) return float.NaN;\n\t\t\tif (conditionValue02 < 0.0f) return GetInputNumber(_inputSocket01, x, y, z, seed);\n\t\t\treturn GetInputNumber(_inputSocket02, x, y, z, seed);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/ConditionNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6c5fd74c308fc4b5b828c33cb29c5dc5\ntimeCreated: 1469219099\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/LimitNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Number\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Number\", \"Limit\")]\n\tpublic class LimitNode : AbstractNumberNode {\n\n\t\t[SerializeField] private bool _minActive;\n\t\t[SerializeField] private bool _maxActive;\n\n\t\t[NonSerialized] private InputSocket _inputSocket01;\n\t\t[NonSerialized] private InputSocket _inputSocketMin;\n\t\t[NonSerialized] private InputSocket _inputSocketMax;\n\n\t\t[NonSerialized] private Rect _tmpRect;\n\n\t\tpublic LimitNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_inputSocket01 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocket01);\n\t\t\t_inputSocketMin = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocketMin);\n\t\t\t_inputSocketMax = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocketMax);\n\n\t\t\t_tmpRect = new Rect();\n\t\t\tHeight = 80;\n\t\t\tWidth = 50;\n\t\t}\n\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\t_tmpRect.Set(3, 20, 50, 20);\n\t\t\tvar currentMin = GUI.Toggle(_tmpRect, _minActive, \"min\");\n\t\t\t_tmpRect.Set(3, 40, 50, 20);\n\t\t\tvar currentMax = GUI.Toggle(_tmpRect, _maxActive, \"max\");\n\n\t\t\tif (currentMin != _minActive || currentMax != _maxActive) TriggerChangeEvent();\n\n\t\t\t_maxActive = currentMax;\n\t\t\t_minActive = currentMin;\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\tvar value01 = GetInputNumber(_inputSocket01, x, y, z, seed);\n\n\t\t\tif (float.IsNaN(value01)) return float.NaN;\n\n\t\t\tif (_minActive)\n\t\t\t{\n\t\t\t\tvar min = GetInputNumber(_inputSocketMin, x, y, z, seed);\n\t\t\t\tif (float.IsNaN(min)) return float.NaN;\n\t\t\t\tvalue01 = Math.Min(value01, min);\n\t\t\t}\n\n\t\t\tif (_maxActive)\n\t\t\t{\n\t\t\t\tvar max = GetInputNumber(_inputSocketMax, x, y, z, seed);\n\t\t\t\tif (float.IsNaN(max)) return float.NaN;\n\t\t\t\tvalue01 = Math.Max(value01, max);\n\t\t\t}\n\n\t\t\treturn value01;\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/LimitNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 89c47b920602c4967bf989ea57a6f93a\ntimeCreated: 1471101336\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/MixNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Number\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Number\", \"Mix\")]\n\tpublic class MixNode : AbstractNumberNode\n\t{\n\t\t[NonSerialized] private Rect labelInput01;\n\t\t[NonSerialized] private Rect labelInput02;\n\t\t[NonSerialized] private Rect labelFactor;\n\n\t\t[NonSerialized] private InputSocket _inputSocket01;\n\t\t[NonSerialized] private InputSocket _inputSocket02;\n\t\t[NonSerialized] private InputSocket _factorSocket;\n\n\t\tpublic MixNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\tlabelInput01 = new Rect(3, 0, 100, 20);\n\t\t\tlabelInput02 = new Rect(3, 20, 100, 20);\n\t\t\tlabelFactor = new Rect(3, 40, 100, 20);\n\n\t\t\t_inputSocket01 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocket02 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_factorSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocket01);\n\t\t\tSockets.Add(_inputSocket02);\n\t\t\tSockets.Add(_factorSocket);\n\t\t\tHeight = 80;\n\t\t\tWidth = 80;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tGUI.Label(labelInput01, \"in 1\");\n\t\t\tGUI.Label(labelInput02, \"in 2\");\n\t\t\tGUI.Label(labelFactor, \"factor (0 - 1)\");\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic static float Clamp(float value, float min, float max)\n\t\t{\n\t\t\treturn value < min ? min : value > max ? max : value;\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\tvar factorValue = GetInputNumber(_factorSocket, x, y, z, seed);\n\t\t\tif (float.IsNaN(factorValue)) return float.NaN;\n\n\t\t\t// to avoid calc of obsolete values here..\n\t\t\tif (factorValue <= 0) return GetInputNumber(_inputSocket01, x, y, z, seed);\n\t\t\tif (factorValue >= 1) return GetInputNumber(_inputSocket02, x, y, z, seed);\n\n\t\t\tfloat v1 = GetInputNumber(_inputSocket01, x, y, z, seed);\n\t\t\tfloat v2 = GetInputNumber(_inputSocket02, x, y, z, seed);\n\n\t\t\tv1 = Clamp(v1, 0, 1);\n\t\t\tv2 = Clamp(v2, 0, 1);\n\n\t\t\tif (float.IsNaN(v1) || float.IsNaN(v2)) return float.NaN;\n\n\t\t\treturn v1 * (1 - factorValue) + v2 * factorValue;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/MixNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0763470b3c68b417fb187271dbd6e67a\ntimeCreated: 1469222135\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/NumberDisplayNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Number\n{\n\n\t[Serializable]\n\t[GraphContextMenuItem(\"Number\", \"Display\")]\n\tpublic class NumberDisplayNode : AbstractNumberNode\n\t{\n\t\t[NonSerialized] public float Value;\n\t\t[NonSerialized] private Rect _textFieldArea;\n\t\t[NonSerialized] private InputSocket _inSocket;\n\n\t\tpublic NumberDisplayNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_textFieldArea = new Rect(10, 0, 80, BonConfig.SocketSize);\n\t\t\t_inSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inSocket);\n\t\t\tHeight = 20 + BonConfig.SocketOffsetTop;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tGUI.Label(_textFieldArea, Value + \"\");\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\t\t\tValue = GetInputNumber(_inSocket, 0, 0, 0, 0);\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\treturn GetInputNumber(_inSocket, x, y, z, seed);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/NumberDisplayNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1e4014aa69aa7452888559025d3201ad\ntimeCreated: 1471101004\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/NumberMultiNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Nodes.Number\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Number\", \"Multi\")]\n\tpublic class NumberMultiNode : AbstractNumberNode\n\t{\n\n\t\t[NonSerialized] private InputSocket _inputSocket;\n\n\t\tpublic NumberMultiNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_inputSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocket);\n\t\t\tSockets.Add(new OutputSocket(this, typeof(AbstractNumberNode))); // second output\n\t\t\tSocketTopOffsetInput = 15;\n\t\t\tWidth = 50;\n\t\t\tHeight = 60;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\treturn GetInputNumber(_inputSocket, x, y, z, seed);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/NumberMultiNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: fd104f85215644d598756fa285ace779\ntimeCreated: 1471101004\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/NumberOperatorNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Number\n{\n\n\t[Serializable]\n\t[GraphContextMenuItem(\"Number\", \"Operator\")]\n\tpublic class NumberOperatorNode : AbstractNumberNode\n\t{\n\n\t\t[SerializeField] private int _selectedMode;\n\n\t\t[NonSerialized]  public static  string[] Operations = { \"add\", \"sub\", \"mul\", \"div\" };\n\t\t[NonSerialized] private InputSocket _inputSocket01;\n\t\t[NonSerialized] private InputSocket _inputSocket02;\n\n\t\tpublic NumberOperatorNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_inputSocket01 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocket01);\n\t\t\t_inputSocket02 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(_inputSocket02);\n\t\t\tHeight = 95;\n\t\t\tWidth = 65;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\n\t\t\tGUILayout.BeginHorizontal();\n\t\t\tGUILayout.FlexibleSpace();\n\t\t\tint newMode = GUILayout.SelectionGrid(_selectedMode,Operations,1,\"toggle\");\n\t\t\tif (newMode != _selectedMode)\n\t\t\t{\n\t\t\t\t_selectedMode = newMode;\n\t\t\t\tTriggerChangeEvent();\n\t\t\t}\n\t\t\tGUILayout.FlexibleSpace();\n\t\t\tGUILayout.EndHorizontal();\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\tvar value01 = GetInputNumber(_inputSocket01, x, y, z, seed);\n\t\t\tvar value02 = GetInputNumber(_inputSocket02, x, y, z, seed);\n\t\t\tif (!float.IsNaN(value01) && !float.IsNaN(value02)) return Calculate(value01, value02);\n\t\t\treturn float.NaN;\n\t\t}\n\n\t\tpublic float Calculate(float value01, float value02)\n\t\t{\n\t\t\tif (_selectedMode == 0) return value01 + value02;\n\t\t\tif (_selectedMode == 1) return value01 - value02;\n\t\t\tif (_selectedMode == 2) return value01 * value02;\n\t\t\tif (_selectedMode == 3)\n\t\t\t{\n\t\t\t\tif (value02.Equals(0)) return float.NaN;\n\t\t\t\treturn value01 / value02;\n\t\t\t}\n\t\t\treturn float.NaN;\n\t\t}\n\n\t\tpublic void SetMode(Operator o)\n\t\t{\n\t\t\tif (o == Operator.Add) _selectedMode = 0;\n\t\t\tif (o == Operator.Substract) _selectedMode = 1;\n\t\t\tif (o == Operator.Multiply) _selectedMode = 2;\n\t\t\tif (o == Operator.Divide) _selectedMode = 3;\n\t\t}\n\t}\n\n\tpublic enum Operator\n\t{\n\t\tAdd,\n\t\tSubstract,\n\t\tMultiply,\n\t\tDivide\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/NumberOperatorNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e74716f60a445496890a0234e0291668\ntimeCreated: 1470916639\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/PowNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\n[Serializable]\n[GraphContextMenuItem(\"Number\", \"Pow\")]\npublic class PowNode : AbstractNumberNode\n{\n\n\tprivate InputSocket _valueSocket01;\n\tprivate InputSocket _valueSocket02;\n\n\tpublic PowNode(int id, Graph parent) : base(id, parent)\n\t{\n\t\t_valueSocket01 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t_valueSocket02 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\tSockets.Add(_valueSocket01);\n\t\tSockets.Add(_valueSocket02);\n\t\tWidth = 50;\n\t\tHeight = 60;\n\t}\n\n\tpublic override void OnGUI()\n\t{\n\n\t}\n\n\tpublic override void Update()\n\t{\n\n\t}\n\n\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t{\n\t\tfloat v1 = GetInputNumber(_valueSocket01, x, y, z, seed);\n\t\tfloat v2 = GetInputNumber(_valueSocket02, x, y, z, seed);\n\t\tif (float.IsNaN(v1) || float.IsNaN(v2)) return float.NaN;\n\t\treturn (float) Math.Pow(v1, v2);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/PowNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 9b267d897fee7436e84d859ffd00bd9e\ntimeCreated: 1471103320\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/RangeNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\n[Serializable]\n[GraphContextMenuItem(\"Number\", \"Range\")]\npublic class RangeNode : AbstractNumberNode {\n\n\n\t[SerializeField] private int _selectedMode;\n\n\t[NonSerialized] private InputSocket _inputSocket01;\n\t[NonSerialized] public static string[] Modes = {\"[-1:1] to [0:1]\", \"[0:1] to [-1:1]\"};\n\n\tpublic RangeNode(int id, Graph parent) : base(id, parent)\n\t{\n\t\t_inputSocket01 = new InputSocket(this, typeof(AbstractNumberNode));\n\t\tSockets.Add(_inputSocket01);\n\t\tHeight = 60;\n\t\tWidth = 100;\n\t}\n\n\tpublic override void OnGUI()\n\t{\n\t\tGUILayout.BeginHorizontal();\n\t\tGUILayout.FlexibleSpace();\n\t\tint newMode = GUILayout.SelectionGrid(_selectedMode, Modes, 1, \"toggle\");\n\t\tif (newMode != _selectedMode)\n\t\t{\n\t\t\t_selectedMode = newMode;\n\t\t\tTriggerChangeEvent();\n\t\t}\n\t\tGUILayout.FlexibleSpace();\n\t\tGUILayout.EndHorizontal();\n\t}\n\n\tpublic override void Update()\n\t{\n\n\t}\n\n\n\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t{\n\t\tfloat value = GetInputNumber(_inputSocket01, x, y, z, seed);\n\t\tif (float.IsNaN(value)) return float.NaN;\n\n\t\tif (_selectedMode == 0) return (value + 1f) / 2f;\n\t\treturn value * 2f - 1f;\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/RangeNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5344d8984c423469782c8017053b0bf0\ntimeCreated: 1471102474\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/SineNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\n\n[Serializable]\n[GraphContextMenuItem(\"Number\", \"Sine\")]\npublic class SineNode : AbstractNumberNode\n{\n\n\tprivate InputSocket _inputSocket;\n\n\tpublic SineNode(int id, Graph parent) : base(id, parent)\n\t{\n\t\t_inputSocket = new InputSocket(this, typeof(AbstractNumberNode));\n\t\tSockets.Add(_inputSocket);\n\t\tWidth = 50;\n\t\tHeight = 50;\n\t}\n\n\tpublic override void OnGUI()\n\t{\n\n\t}\n\n\tpublic override void Update()\n\t{\n\n\t}\n\n\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t{\n\t\tvar number = GetInputNumber(_inputSocket, x, y, z, seed);\n\t\tif (float.IsNaN(number)) return float.NaN;\n\t\treturn (float) Math.Sin(number);\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/SineNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c3780a702faa849ceb9b1d9222b5c313\ntimeCreated: 1471100393\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/SingleNumberSampler.cs",
    "content": "﻿using Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Nodes.Number\n{\n\tpublic class SingleNumberSampler : INumberSampler\n\t{\n\t\tprivate float _number;\n\n\t\tpublic SingleNumberSampler(float number)\n\t\t{\n\t\t\t_number = number;\n\t\t}\n\n\t\tpublic float GetNumber(OutputSocket s, float x, float y, float z, float seed)\n\t\t{\n\t\t\treturn _number;\n\t\t}\n\n\t\tpublic int GetId()\n\t\t{\n\t\t\treturn -1;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number/SingleNumberSampler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 72ac3326fbd1f46969e18163b78cad0f\ntimeCreated: 1471352812\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Number.meta",
    "content": "fileFormatVersion: 2\nguid: 80aea065b504b4f80afc6bc9faeb6efc\nfolderAsset: yes\ntimeCreated: 1470915819\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Scatter/GridScatterNode.cs",
    "content": "﻿using Assets.Code.Bon;\nusing System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\n\n[Serializable]\n[GraphContextMenuItem(\"Scatter\", \"Grid\")]\npublic class GridScatterNode : AbstractVector3Node\n{\n\n\tprivate InputSocket _inputX;\n\tprivate InputSocket _inputZ;\n\n\tprivate Rect _tmpRect;\n\n\tpublic GridScatterNode(int id, Graph parent) : base(id, parent)\n\t{\n\t\t_inputX = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t_inputZ = new InputSocket(this, typeof(AbstractNumberNode));\n\n\t\t_inputX.SetDirectInputNumber(5, false);\n\t\t_inputZ.SetDirectInputNumber(5, false);\n\n\t\tSockets.Add(_inputX);\n\t\tSockets.Add(_inputZ);\n\n\t\tSockets.Add(new OutputSocket(this, typeof(AbstractVector3Node)));\n\n\t\t_tmpRect = new Rect();\n\n\t\tHeight = 60;\n\t\tWidth = 50;\n\t}\n\n\tpublic override void OnGUI()\n\t{\n\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t_tmpRect.Set(3, 0, 50, 20);\n\t\tGUI.Label(_tmpRect, \"scale x\");\n\t\t_tmpRect.Set(3, 20, 50, 20);\n\t\tGUI.Label(_tmpRect, \"scale z\");\n\t\tGUI.skin.label.alignment = TextAnchor.MiddleCenter;\n\t}\n\n\tpublic override void Update()\n\t{\n\n\t}\n\n\tpublic override List<Vector3> GetVector3List(OutputSocket s, float x, float y, float z, float sizeX, float sizeY, float sizeZ, float seed)\n\t{\n\t\tfloat left = x;\n\t\tfloat right = x + sizeX;\n\n\t\tif (sizeX < 0)\n\t\t{\n\t\t\tleft = x + sizeX;\n\t\t\tright = x;\n\t\t}\n\n\t\tleft = (float) Math.Floor(left);\n\t\tright = (float) Math.Ceiling(right);\n\n\t\tfloat bottom = z;\n\t\tfloat top = z + sizeZ;\n\n\t\tif (sizeZ < 0)\n\t\t{\n\t\t\tbottom = z + sizeZ;\n\t\t\ttop = z;\n\t\t}\n\n\t\tbottom = (float) Math.Floor(bottom);\n\t\ttop = (float) Math.Ceiling(top);\n\n\t\tfloat scaleX = AbstractNumberNode.GetInputNumber(_inputX, x, y, z, seed);\n\t\tfloat scaleZ = AbstractNumberNode.GetInputNumber(_inputZ, x, y, z, seed);\n\n\n\t\tList<Vector3> positions = new List<Vector3>();\n\t\tfor (int leftIndex = (int) Math.Floor(left / scaleX); leftIndex <= (int) Math.Ceiling(right / scaleX); leftIndex++)\n\t\t{\n\t\t\tfor (int bottomIndex = (int) Math.Floor(bottom / scaleZ); bottomIndex <= (int) Math.Ceiling(top / scaleZ); bottomIndex++)\n\t\t\t{\n\t\t\t\tif (leftIndex * scaleX >= left && leftIndex * scaleX < right)\n\t\t\t\t{\n\t\t\t\t\tif (bottomIndex * scaleZ >= bottom && bottomIndex * scaleZ < top)\n\t\t\t\t\t{\n\t\t\t\t\t\tpositions.Add(new Vector3(leftIndex * scaleX, 0, bottomIndex * scaleZ));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn positions;\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Scatter/GridScatterNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: df9f5949009be4df0aa37fe487177579\ntimeCreated: 1471358547\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Scatter.meta",
    "content": "fileFormatVersion: 2\nguid: e67a778ba4b7a41f39d9eeeaaf8dde83\nfolderAsset: yes\ntimeCreated: 1471358424\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/String/StringNode.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.String\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"String\", \"String\")]\n\tpublic class StringNode : AbstractStringNode {\n\n\t\t[SerializeField] private string _text = \"\";\n\t\t[NonSerialized] private Rect _textFieldRect;\n\n\t\tpublic StringNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_textFieldRect = new Rect(3, 0, 100, 20);\n\t\t\tSockets.Add(new OutputSocket(this, typeof(AbstractStringNode)));\n\t\t\tHeight = 45;\n\t\t\tWidth = 108;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tstring newText = GUI.TextField(_textFieldRect, _text);\n\t\t\tif (!newText.Equals(_text)) TriggerChangeEvent();\n\t\t\t_text = newText;\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override string GetString(OutputSocket outSocket)\n\t\t{\n\t\t\treturn _text;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/String/StringNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 486a1e75efea448d2ab23b8d5dd84962\ntimeCreated: 1470941004\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/String.meta",
    "content": "fileFormatVersion: 2\nguid: 7500f91913ae945f189bab29ddbe32a7\nfolderAsset: yes\ntimeCreated: 1470940963\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/OperatorNode.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Vector3\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Vector\", \"Operator\")]\n\tpublic class OperatorNode : AbstractVector3Node\n\t{\n\n\t\t[SerializeField] private int _selectedMode;\n\t\t[NonSerialized] public static string[] Operations = {\"add\", \"sub\", \"mul\", \"div\"};\n\n\t\tprivate InputSocket _inputSocketVectors;\n\t\tprivate InputSocket _inputSocketX;\n\t\tprivate InputSocket _inputSocketY;\n\t\tprivate InputSocket _inputSocketZ;\n\n\t\tprivate Rect _tmpRect;\n\n\t\tpublic OperatorNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_tmpRect = new Rect();\n\t\t\t_inputSocketVectors = new InputSocket(this, typeof(AbstractVector3Node));\n\n\t\t\t_inputSocketX = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocketY = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocketZ = new InputSocket(this, typeof(AbstractNumberNode));\n\n\t\t\tSockets.Add(_inputSocketVectors);\n\t\t\tSockets.Add(_inputSocketX);\n\t\t\tSockets.Add(_inputSocketY);\n\t\t\tSockets.Add(_inputSocketZ);\n\n\t\t\tSockets.Add(new OutputSocket(this, typeof(AbstractVector3Node)));\n\t\t\tWidth = 100;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t\t_tmpRect.Set(3, 0, 60, 20);\n\t\t\tGUI.Label(_tmpRect, \"vec\");\n\n\t\t\t_tmpRect.Set(3, 20, 60, 20);\n\t\t\tGUI.Label(_tmpRect, \"x\");\n\n\t\t\t_tmpRect.Set(3, 40, 60, 20);\n\t\t\tGUI.Label(_tmpRect, \"y\");\n\n\t\t\t_tmpRect.Set(3, 60, 60, 20);\n\t\t\tGUI.Label(_tmpRect, \"z\");\n\n\t\t\t_tmpRect.Set(50, 0, 40, 80);\n\t\t\tint newMode = GUI.SelectionGrid(_tmpRect, _selectedMode, Operations, 1, \"toggle\");\n\t\t\tif (newMode != _selectedMode)\n\t\t\t{\n\t\t\t\t_selectedMode = newMode;\n\t\t\t\tTriggerChangeEvent();\n\t\t\t}\n\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleCenter;\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override List<UnityEngine.Vector3> GetVector3List(OutputSocket s, float x, float y, float z, float sizeX, float sizeY, float sizeZ, float seed)\n\t\t{\n\t\t\tList<UnityEngine.Vector3> vectors = GetInputVector3List(_inputSocketVectors, x, y, z, sizeX, sizeY, sizeZ, seed);\n\t\t\tif (vectors != null)\n\t\t\t{\n\t\t\t\tfor (var i = 0; i < vectors.Count; i++)\n\t\t\t\t{\n\t\t\t\t\tUnityEngine.Vector3 v = vectors[i];\n\n\t\t\t\t\tfloat valueX = AbstractNumberNode.GetInputNumber(_inputSocketX, v.x, v.y, v.z, seed);\n\t\t\t\t\tfloat valueY = AbstractNumberNode.GetInputNumber(_inputSocketY, v.x, v.y, v.z, seed);\n\t\t\t\t\tfloat valueZ = AbstractNumberNode.GetInputNumber(_inputSocketZ, v.x, v.y, v.z, seed);\n\n\t\t\t\t\t//Debug.Log(\"valueX \" + valueX + \" valueY \" + valueY + \" valueZ \" + valueZ);\n\n\t\t\t\t\tif (_selectedMode == 0) v.Set(v.x + valueX, v.y + valueY, v.z + valueZ);\n\t\t\t\t\tif (_selectedMode == 1) v.Set(v.x - valueX, v.y - valueY, v.z - valueZ);\n\t\t\t\t\tif (_selectedMode == 2) v.Set(v.x * valueX, v.y * valueY, v.z * valueZ);\n\t\t\t\t\tif (_selectedMode == 3) v.Set(valueX != 0 ? v.x / valueX : v.x, valueY != 0 ? v.y / valueY : v.y, valueZ != 0 ? v.z / valueZ : valueZ);\n\n\t\t\t\t\tvectors[i] = v;\n\n\t\t\t\t\t//Debug.Log(\"x \" + vectors[i].x + \" y \" + vectors[i].y + \" z \" + vectors[i].z + \" valueY \" + valueY);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn vectors;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/OperatorNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1351590c2aa104e03ae69cfd5e0a32b1\ntimeCreated: 1471367739\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/RamdomOffsetNode.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\n\nnamespace Assets.Code.Bon.Nodes.Vector3\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Vector\", \"Random Offset\")]\n\tpublic class RamdomOffsetNode : AbstractVector3Node\n\t{\n\n\t\t[SerializeField] private bool _offsetX = true;\n\t\t[SerializeField] private bool _offsetY = true;\n\t\t[SerializeField] private bool _offsetZ = true;\n\n\t\tprivate InputSocket _inputSocketVec;\n\t\tprivate InputSocket _inputSocketOffset;\n\t\tprivate InputSocket _inputSocketNoise;\n\n\t\tprivate Rect _tmpRect;\n\n\t\tpublic RamdomOffsetNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\n\t\t\t_inputSocketVec = new InputSocket(this, typeof(AbstractVector3Node));\n\t\t\t_inputSocketOffset = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputSocketNoise = new InputSocket(this, typeof(AbstractNumberNode));\n\n\t\t\tSockets.Add(_inputSocketVec);\n\t\t\tSockets.Add(_inputSocketOffset);\n\t\t\tSockets.Add(_inputSocketNoise);\n\n\t\t\tSockets.Add(new OutputSocket(this, typeof(AbstractVector3Node)));\n\t\t\tWidth = 90;\n\t\t\tHeight = 80;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t\t_tmpRect.Set(3, 0, 50, 20);\n\t\t\tGUI.Label(_tmpRect, \"vec\");\n\t\t\t_tmpRect.Set(3, 20, 50, 20);\n\t\t\tGUI.Label(_tmpRect, \"offset\");\n\t\t\t_tmpRect.Set(3, 40, 50, 20);\n\t\t\tGUI.Label(_tmpRect, \"noise\");\n\n\t\t\t_tmpRect.Set(50, 0, 50, 20);\n\t\t\tvar currentOffsetX = GUI.Toggle(_tmpRect, _offsetX, \"x\");\n\t\t\t_tmpRect.Set(50, 20, 50, 20);\n\t\t\tvar currentOffsetY = GUI.Toggle(_tmpRect, _offsetY, \"y\");\n\t\t\t_tmpRect.Set(50, 40, 50, 20);\n\t\t\tvar currentOffsetZ = GUI.Toggle(_tmpRect, _offsetZ, \"z\");\n\n\t\t\tbool needsUpdate = currentOffsetX != _offsetX || currentOffsetY != _offsetY || currentOffsetZ != _offsetZ;\n\t\t\t_offsetX = currentOffsetX;\n\t\t\t_offsetY = currentOffsetY;\n\t\t\t_offsetZ = currentOffsetZ;\n\t\t\tif (needsUpdate) TriggerChangeEvent();\n\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleCenter;\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override List<UnityEngine.Vector3> GetVector3List(OutputSocket socket, float x, float y, float z, float sizeX, float sizeY, float sizeZ, float seed)\n\t\t{\n\t\t\tList<UnityEngine.Vector3> vec = GetInputVector3List(_inputSocketVec, x, y, z, sizeX, sizeY, sizeZ, seed);\n\t\t\tif (vec == null) return null;\n\n\t\t\tfor (var i = 0; i < vec.Count; i++)\n\t\t\t{\n\t\t\t\tUnityEngine.Vector3 v = vec[i];\n\n\t\t\t\tfloat noise = AbstractNumberNode.GetInputNumber(_inputSocketNoise, v.x, v.y, v.z, seed);\n\t\t\t\tfloat offset = AbstractNumberNode.GetInputNumber(_inputSocketOffset, v.x, v.y, v.z, seed);\n\n\t\t\t\tif (float.IsNaN(noise) || float.IsNaN(offset))\tcontinue;\n\n\t\t\t\tif (_offsetX) v.x += offset * noise;\n\t\t\t\tif (_offsetY) v.y += offset * noise;\n\t\t\t\tif (_offsetZ) v.z += offset * noise;\n\n\t\t\t\tvec[i] = v;\n\t\t\t}\n\n\t\t\treturn vec;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/RamdomOffsetNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1db8bbd50a79c450baeb1674a8a689fd\ntimeCreated: 1471469600\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/SplitNode.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\n[Serializable]\n[GraphContextMenuItem(\"Vector\", \"Split\")]\npublic class SplitNode : AbstractVector3Node\n{\n\tprivate InputSocket _inputSocketVector;\n\tprivate InputSocket _inputSocketMask;\n\n\tprivate OutputSocket _outputSocket01;\n\tprivate OutputSocket _outputSocket02;\n\n\tprivate Rect _tmpRect;\n\n\tpublic SplitNode(int id, Graph parent) : base(id, parent)\n\t{\n\t\t_inputSocketMask = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t_inputSocketVector = new InputSocket(this, typeof(AbstractVector3Node));\n\n\t\t_outputSocket01 = new OutputSocket(this, typeof(AbstractVector3Node));\n\t\t_outputSocket02 = new OutputSocket(this, typeof(AbstractVector3Node));\n\n\t\tSockets.Add(_inputSocketVector);\n\t\tSockets.Add(_inputSocketMask);\n\n\t\tSockets.Add(_outputSocket01);\n\t\tSockets.Add(_outputSocket02);\n\t\tHeight = 60;\n\n\t}\n\n\tpublic override void OnGUI()\n\t{\n\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t_tmpRect.Set(3, 0, 40, 20);\n\t\tGUI.Label(_tmpRect, \"vec\");\n\n\t\t_tmpRect.Set(3, 20, 40, 20);\n\t\tGUI.Label(_tmpRect, \"mask\");\n\n\t\tGUI.skin.label.alignment = TextAnchor.MiddleRight;\n\t\t_tmpRect.Set(45, 0, 50, 20);\n\t\tGUI.Label(_tmpRect, \">=0\");\n\n\t\t_tmpRect.Set(45, 20, 50, 20);\n\t\tGUI.Label(_tmpRect, \"<0\");\n\n\t\tGUI.skin.label.alignment = TextAnchor.MiddleCenter;\n\t}\n\n\tpublic override void Update()\n\t{\n\n\t}\n\n\tpublic override List<Vector3> GetVector3List(OutputSocket outSocket, float x, float y, float z, float sizeX, float sizeY, float sizeZ, float seed)\n\t{\n\t\tList<Vector3> vec = GetInputVector3List(_inputSocketVector, x, y, z, sizeX, sizeY, sizeZ, seed);\n\t\tif (vec == null) return null;\n\n\t\tList<Vector3> removeList = new List<Vector3>();\n\n\t\tfor (var i = 0; i < vec.Count; i++)\n\t\t{\n\t\t\tfloat maskValue = AbstractNumberNode.GetInputNumber(_inputSocketMask, vec[i].x, vec[i].y, vec[i].z, seed);\n\t\t\tif (maskValue < 0 && outSocket == _outputSocket01) removeList.Add(vec[i]);\n\t\t\tif (maskValue >= 0 && outSocket == _outputSocket02) removeList.Add(vec[i]);\n\t\t}\n\n\t\tforeach (var r in removeList) vec.Remove(r);\n\t\treturn vec;\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/SplitNode.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6ef308653e83c459ebabea2deb766392\ntimeCreated: 1471436831\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/Vector3DisplayColorSampler.cs",
    "content": "﻿using Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Socket;\n\nnamespace Assets.Code.Bon.Nodes.Vector3\n{\n\tpublic class Vector3DisplayColorSampler : IColorSampler {\n\n\t\tprivate UnityEngine.Color transparentColor = new UnityEngine.Color(0f, 0f, 0f, 0f);\n\n\t\tpublic UnityEngine.Color GetColor(OutputSocket s, float i)\n\t\t{\n\t\t\tif (i == 1f) return UnityEngine.Color.white;\n\t\t\treturn transparentColor;\n\t\t}\n\n\t\tpublic int GetId()\n\t\t{\n\t\t\treturn -1;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/Vector3DisplayColorSampler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 59aa5dff7cea342acac92a0116adb1dd\ntimeCreated: 1471356039\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/Vector3Node.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Nodes.Vector3\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Vector\", \"Vector3\")]\n\tpublic class Vector3Node : AbstractVector3Node\n\t{\n\n\t\tprivate InputSocket _inputX;\n\t\tprivate InputSocket _inputY;\n\t\tprivate InputSocket _inputZ;\n\n\t\tprivate Rect _tmpRect;\n\n\t\tpublic Vector3Node(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t_tmpRect = new Rect();\n\n\t\t\t_inputX = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputY = new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\t_inputZ = new InputSocket(this, typeof(AbstractNumberNode));\n\n\n\t\t\tSockets.Add(_inputX);\n\t\t\tSockets.Add(_inputY);\n\t\t\tSockets.Add(_inputZ);\n\n\t\t\tSockets.Add(new OutputSocket(this, typeof(AbstractVector3Node)));\n\n\t\t\tWidth = 60;\n\t\t\tHeight = 84;\n\t\t}\n\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleLeft;\n\t\t\t_tmpRect.Set(3, 0, 50, 20);\n\t\t\tGUI.Label(_tmpRect, \"x\");\n\t\t\t_tmpRect.Set(3, 20, 50, 20);\n\t\t\tGUI.Label(_tmpRect, \"y\");\n\t\t\t_tmpRect.Set(3, 40, 50, 20);\n\t\t\tGUI.Label(_tmpRect, \"z\");\n\t\t\tGUI.skin.label.alignment = TextAnchor.MiddleCenter;\n\t\t}\n\n\t\tpublic override void Update()\n\t\t{\n\n\t\t}\n\n\t\tpublic override List<UnityEngine.Vector3> GetVector3List(OutputSocket outSocket, float x, float y, float z,\n\t\t\tfloat sizeX, float sizeY, float sizeZ, float seed)\n\t\t{\n\t\t\tfloat valueX = AbstractNumberNode.GetInputNumber(_inputX, x, y, z, seed);\n\t\t\tfloat valueY = AbstractNumberNode.GetInputNumber(_inputY, x, y, z, seed);\n\t\t\tfloat valueZ = AbstractNumberNode.GetInputNumber(_inputZ, x, y, z, seed);\n\t\t\tList<UnityEngine.Vector3> positions = new List<UnityEngine.Vector3>();\n\t\t\tpositions.Add(new UnityEngine.Vector3(valueX, valueY, valueZ));\n\t\t\treturn positions;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3/Vector3Node.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f463bf53a64ff4ed093d20ed55f06c7d\ntimeCreated: 1471356120\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes/Vector3.meta",
    "content": "fileFormatVersion: 2\nguid: 4a7ecc73542c049ec85f1bcc9b59b82d\nfolderAsset: yes\ntimeCreated: 1471356038\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Nodes.meta",
    "content": "fileFormatVersion: 2\nguid: ab51cecbb54514cefb3e9eb846f80583\nfolderAsset: yes\ntimeCreated: 1466621268\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Socket/AbstractSocket.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Nodes;\nusing Assets.Code.Bon.Socket;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon\n{\n\n\tpublic abstract class AbstractSocket\n\t{\n\t\tpublic Type Type;\n\t\tpublic Node Parent;\n\n\t\tprotected Rect BoxRect;\n\t\tprotected RectOffset Padding;\n\n\t\tprotected AbstractSocket(Node parent, Type type)\n\t\t{\n\t\t\tType = type;\n\t\t\tPadding = new RectOffset(0, 0, -2, 0);\n\t\t\tParent = parent;\n\t\t\tBoxRect.width = BonConfig.SocketSize;\n\t\t\tBoxRect.height = BonConfig.SocketSize;\n\t\t}\n\n\t\t/// The x position of the node\n\t\tpublic float X\n\t\t{\n\t\t\tget { return BoxRect.x; }\n\t\t\tset { BoxRect.x = value; }\n\t\t}\n\n\t\t/// The y position of the node\n\t\tpublic float Y\n\t\t{\n\t\t\tget { return BoxRect.y; }\n\t\t\tset { BoxRect.y = value; }\n\t\t}\n\n\t\tpublic abstract bool IsConnected();\n\t\tprotected abstract void OnDraw();\n\t\tpublic abstract bool Intersects(Vector2 nodePosition);\n\n\n\t\tpublic void Draw()\n\t\t{\n\t\t\tGUI.skin.box.normal.textColor = Node.GetEdgeColor(Type);\n\t\t\tGUI.skin.box.padding = Padding;\n\t\t\tGUI.skin.box.fontSize = 14;\n\t\t\tGUI.skin.box.fontStyle = FontStyle.Bold;\n\t\t\tOnDraw();\n\t\t}\n\n\t\tpublic bool IsInput()\n\t\t{\n\t\t\treturn GetType() == typeof(InputSocket);\n\t\t}\n\n\t\tpublic bool IsOutput()\n\t\t{\n\t\t\treturn GetType() == typeof(OutputSocket);\n\t\t}\n\n\t}\n\n}\n\n\n"
  },
  {
    "path": "Assets/Code/Bon/Socket/AbstractSocket.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b436cb7caba1e43ea88da1432d8051d9\ntimeCreated: 1471525692\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Socket/InputSocket.cs",
    "content": "﻿using System;\nusing Assets.Code.Bon.Nodes;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Socket\n{\n\tpublic class InputSocket : AbstractSocket {\n\n\t\tpublic Edge Edge;\n\n\t\tprivate Rect _directInputRect;\n\t\tprivate float _directInputNumber = float.NaN;\n\t\tprivate string _directInputString = \"0\";\n\n\t\tpublic InputSocket(Node parent, Type type) : base(parent, type)\n\t\t{\n\t\t}\n\n\t\tpublic bool CanGetResult()\n\t\t{\n\t\t\tif (IsInDirectInputMode()) return true;\n\t\t\treturn IsInput() && IsConnected();\n\t\t}\n\n\t\tpublic bool IsInDirectInputMode()\n\t\t{\n\t\t\treturn Type == typeof(AbstractNumberNode) && IsInput() && Edge == null;\n\t\t}\n\n\t\tprivate float CalcDirectInputOffset()\n\t\t{\n\t\t\treturn GUI.skin.textField.CalcSize(new GUIContent(_directInputString)).x + 5;\n\t\t}\n\n\t\tprivate void DrawDirectNumberInput()\n\t\t{\n\t\t\tfloat width = CalcDirectInputOffset();\n\t\t\tBoxRect.x -= width;\n\t\t\tGUI.Box(BoxRect, \">\");\n\t\t\t_directInputRect.Set(BoxRect.x + BoxRect.width, BoxRect.y, width, BoxRect.height);\n\t\t\tif (NodeUtils.FloatTextField(_directInputRect, ref _directInputString))\n\t\t\t{\n\t\t\t\t_directInputNumber = float.Parse(_directInputString);\n\t\t\t\tParent.TriggerChangeEvent();\n\t\t\t}\n\t\t\tBoxRect.x += width;\n\t\t}\n\n\t\tpublic float GetDirectInputNumber()\n\t\t{\n\t\t\tif (float.IsNaN(_directInputNumber)) _directInputNumber = float.Parse(_directInputString);\n\t\t\treturn _directInputNumber;\n\t\t}\n\n\t\tpublic void SetDirectInputNumber(float number, bool triggerChangeEvent)\n\t\t{\n\t\t\tif (!float.IsNaN(number))\n\t\t\t{\n\t\t\t\t_directInputNumber = number;\n\t\t\t\t_directInputString = number + \"\";\n\t\t\t\tif (triggerChangeEvent) Parent.TriggerChangeEvent();\n\t\t\t}\n\t\t}\n\n\t\tpublic override bool IsConnected()\n\t\t{\n\t\t\treturn Edge != null;\n\t\t}\n\n\t\tpublic override bool Intersects(Vector2 nodePosition)\n\t\t{\n\t\t\tif (Parent.Collapsed) return false;\n\n\t\t\tif (IsInDirectInputMode())\n\t\t\t{\n\t\t\t\tfloat width = CalcDirectInputOffset();\n\t\t\t\tBoxRect.x -= width;\n\t\t\t\tvar intersects = BoxRect.Contains(nodePosition);\n\t\t\t\tBoxRect.x += width;\n\t\t\t\treturn intersects;\n\t\t\t}\n\t\t\treturn BoxRect.Contains(nodePosition);\n\t\t}\n\n\t\tprotected override void OnDraw()\n\t\t{\n\t\t\tif (IsInDirectInputMode()) DrawDirectNumberInput();\n\t\t\telse GUI.Box(BoxRect, \">\");\n\t\t}\n\n\t\tpublic OutputSocket GetConnectedSocket()\n\t\t{\n\t\t\treturn Edge.Output;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Socket/InputSocket.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 2e13361cd5d234f088308b5f550258b4\ntimeCreated: 1471525723\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Socket/OutputSocket.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Socket\n{\n\tpublic class OutputSocket : AbstractSocket\n\t{\n\n\t\tpublic List<Edge> Edges;\n\n\t\tpublic OutputSocket(Node parent, Type type) : base(parent, type)\n\t\t{\n\t\t\tEdges = new List<Edge>();\n\t\t}\n\n\t\tpublic override bool IsConnected()\n\t\t{\n\t\t\treturn Edges.Count > 0;\n\t\t}\n\n\t\tpublic override bool Intersects(Vector2 nodePosition)\n\t\t{\n\t\t\tif (Parent.Collapsed) return false;\n\t\t\treturn BoxRect.Contains(nodePosition);\n\t\t}\n\n\t\tprotected override void OnDraw()\n\t\t{\n\t\t\tGUI.Box(BoxRect, \">\");\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Socket/OutputSocket.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d8967716d69734b8a92df22db10ad90c\ntimeCreated: 1471525713\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Socket.meta",
    "content": "fileFormatVersion: 2\nguid: bbfbe20d4a0f34c0482bdb14081b2251\nfolderAsset: yes\ntimeCreated: 1471525691\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/StandardGraphController.cs",
    "content": "﻿using UnityEngine;\n\nnamespace Assets.Code.Bon\n{\n\tpublic class StandardGraphController\n\t{\n\n\t\tpublic StandardGraphController()\n\t\t{\n\t\t}\n\n\t\tpublic void Register()\n\t\t{\n\t\t\tEventManager.OnCreateGraph += OnCreate;\n\t\t\tEventManager.OnFocusGraph += OnFocus;\n\t\t\tEventManager.OnCloseGraph += OnClose;\n\t\t\tEventManager.OnLinkEdge += OnLink;\n\t\t\tEventManager.OnUnLinkSockets += OnUnLink;\n\t\t\tEventManager.OnUnLinkedSockets += OnUnLinked;\n\t\t\tEventManager.OnAddedNode += OnNodeAdded;\n\t\t\tEventManager.OnNodeRemoved += OnNodeRemoved;\n\t\t\tEventManager.OnChangedNode += OnNodeChanged;\n\t\t\tEventManager.OnFocusNode += OnFocusNode;\n\t\t\tEventManager.OnEditorWindowOpen += OnWindowOpen;\n\t\t}\n\n\t\tprivate void OnWindowOpen()\n\t\t{\n\n\t\t}\n\n\t\tpublic void OnCreate(Graph graph)\n\t\t{\n\n\t\t\tgraph.UpdateNodes();\n\t\t}\n\n\t\tpublic void OnFocus(Graph graph)\n\t\t{\n\t\t\tLog.Info(\"OnFocus \" + graph);\n\t\t}\n\n\t\tpublic void OnClose(Graph graph)\n\t\t{\n\t\t\tLog.Info(\"OnClose \" + graph);\n\t\t}\n\n\t\t// ======= Events =======\n\t\tpublic void OnLink(Graph graph, Edge edge)\n\t\t{\n\t\t\tLog.Info(\"OnLink: Node \" + edge.Output.Parent.Id + \" with Node \" + edge.Input.Parent.Id);\n\t\t\tgraph.UpdateDependingNodes(edge.Output.Parent);\n\t\t}\n\n\t\tpublic void OnUnLink(Graph graph, AbstractSocket s01, AbstractSocket s02)\n\t\t{\n\t\t\t// Log.Info(\"OnUnLink: Node \" + s01.Edge.Output.Parent.Id + \" from Node \" + s02.Edge.Input.Parent.Id);\n\t\t}\n\n\t\tpublic void OnUnLinked(Graph graph, AbstractSocket s01, AbstractSocket s02)\n\t\t{\n\t\t\tLog.Info(\"OnUnLinked: Socket \" + s02 + \" and Socket \" + s02);\n\t\t\tvar input = s01.IsInput () ? s01 : s02;\n\t\t\tgraph.UpdateDependingNodes(input.Parent);\n\t\t}\n\n\t\tpublic void OnNodeAdded(Graph graph, Node node)\n\t\t{\n\t\t\tLog.Info(\"OnNodeAdded: Node \" + node.GetType() + \" with id \" + node.Id);\n\t\t}\n\n\t\tpublic void OnNodeRemoved(Graph graph, Node node)\n\t\t{\n\t\t\tLog.Info(\"OnNodeRemoved: Node \" + node.GetType() + \" with id \" + node.Id);\n\t\t}\n\n\t\tpublic void OnNodeChanged(Graph graph, Node node)\n\t\t{\n\t\t\tLog.Info(\"OnNodeChanged: Node \" + node.GetType() + \" with id \" + node.Id);\n\t\t\tgraph.UpdateDependingNodes(node);\n\t\t}\n\n\t\tpublic void OnFocusNode(Graph graph, Node node)\n\t\t{\n\t\t\tLog.Info(\"OnFocus: \" + node.Id);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/StandardGraphController.cs.meta",
    "content": "fileFormatVersion: 2\nguid: cc8905af25d8c494992be201fe195601\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Thread/GUIThreadedTexture.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Assets.Code.Bon.Interface;\nusing Assets.Code.Bon.Nodes.Noise;\nusing UnityEngine;\nusing UnityEngineInternal;\n\npublic class GUIThreadedTexture {\n\n\tprivate Rect _textureArea;\n\tprivate bool _isUpdatingTexture;\n\tprivate TextureUpdateJob _job;\n\tprivate Texture2D _texture;\n\tprivate bool _initialUpdate;\n\n\tpublic bool IsUpdating\n\t{\n\t\tget { return _isUpdatingTexture; }\n\t}\n\n\tpublic bool DoneInitialUpdate\n\t{\n\t\tget { return _initialUpdate; }\n\t}\n\n\tpublic float X\n\t{\n\t\tget { return _textureArea.x; }\n\t\tset { _textureArea.x = value; }\n\t}\n\n\tpublic float Y\n\t{\n\t\tget { return _textureArea.y; }\n\t\tset { _textureArea.y = value; }\n\t}\n\n\tpublic float Width\n\t{\n\t\tget { return _textureArea.width; }\n\t}\n\n\tpublic float Height\n\t{\n\t\tget { return _textureArea.height; }\n\t}\n\n\tpublic GUIThreadedTexture()\n\t{\n\t\t_textureArea = new Rect(6, 0, 0, 0);\n\t\t_job = new TextureUpdateJob();\n\t}\n\n\tpublic void OnGUI()\n\t{\n\t\tif (!DoneInitialUpdate) return;\n\t\t_isUpdatingTexture = UpdateTextureJob();\n\t\tif (_texture != null && !_isUpdatingTexture) GUI.DrawTexture(_textureArea, _texture);\n\t}\n\n\tpublic void StartTextureUpdateJob(int width, int height, INumberSampler numberSampler, IColorSampler samplerColor)\n\t{\n\t\tInitJob(width, height);\n\t\t_job.Request(width, height, numberSampler, samplerColor);\n\t\t_job.Start();\n\t}\n\n\tpublic void StartTextureUpdateJob(int width, int height, List<Vector3> vectors)\n\t{\n\t\tInitJob(width, height);\n\t\t_job.Request(width, height, vectors);\n\t\t_job.Start();\n\t}\n\n\tprivate void InitJob(int width, int height)\n\t{\n\t\t_textureArea.Set(_textureArea.x, _textureArea.y, width, height);\n\t\t_job = new TextureUpdateJob();\n\t\t_initialUpdate = true;\n\t\tif (_texture == null) CreateTexture(width, height);\n\t\tif (_job != null && !_job.IsDone) _job.Abort();\n\t}\n\n\tprivate bool UpdateTextureJob()\n\t{\n\t\tif (_job == null) return false;\n\t\t_job.Update();\n\t\t/*if (!CanCreatePreview())\n\t\t{\n\n\t\t}*/\n\n\t\tif (!_job.IsDone) return true;\n\t\t_texture = _job.Texture;\n\t\t_job.Abort();\n\t\t_job = null;\n\t\treturn false;\n\t}\n\n\tprivate void CreateTexture(int width, int height)\n\t{\n\t\tif (_texture != null) Texture2D.DestroyImmediate(_texture);\n\t\t_texture = new Texture2D(width, height, TextureFormat.RGB24, false);\n\t\t_textureArea.Set(_textureArea.x, _textureArea.y, width, height);\n\t}\n\n\tpublic void Hide()\n\t{\n\t\tif (_job != null) _job.Abort();\n\t\tif (_texture != null) Texture2D.DestroyImmediate(_texture);\n\t\t_job = null;\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Thread/GUIThreadedTexture.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 103d8b9b8ff8541328f034529f363aff\ntimeCreated: 1471345641\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Thread/ThreadedJob.cs",
    "content": "﻿using System.Collections;\n\nnamespace Assets.Code.Bon.Thread\n{\n\tpublic abstract class ThreadedJob  {\n\n\t\tprivate bool _IsDone;\n\t\tprivate object _Handle = new object();\n\n\t\tprivate System.Threading.Thread _Thread;\n\n\t\tpublic bool IsDone\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tbool tmp;\n\t\t\t\tlock (_Handle)\n\t\t\t\t{\n\t\t\t\t\ttmp = _IsDone;\n\t\t\t\t}\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tlock (_Handle)\n\t\t\t\t{\n\t\t\t\t\t_IsDone = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic virtual void Start()\n\t\t{\n\t\t\t_Thread = new System.Threading.Thread(Run);\n\t\t\t_Thread.Start();\n\t\t}\n\n\t\tpublic virtual void Abort()\n\t\t{\n\t\t\tif (_Thread != null) _Thread.Abort();\n\t\t}\n\n\t\tprotected virtual void ThreadFunction() { }\n\n\t\tprotected virtual void OnFinished() { }\n\n\t\tpublic virtual bool Update()\n\t\t{\n\t\t\tif (IsDone)\n\t\t\t{\n\t\t\t\tOnFinished();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic IEnumerator WaitFor()\n\t\t{\n\t\t\twhile(!Update())\n\t\t\t{\n\t\t\t\tyield return null;\n\t\t\t}\n\t\t}\n\n\t\tprivate void Run()\n\t\t{\n\t\t\tThreadFunction();\n\t\t\tIsDone = true;\n\t\t}\n\n\t\tpublic bool IsStarted()\n\t\t{\n\t\t\treturn _Thread != null;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Code/Bon/Thread/ThreadedJob.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3ed789335a32346c698923faa7decf7a\ntimeCreated: 1469206970\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon/Thread.meta",
    "content": "fileFormatVersion: 2\nguid: e8dcaa868079b4e0abd79b198fe7e2de\nfolderAsset: yes\ntimeCreated: 1469213416\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code/Bon.meta",
    "content": "fileFormatVersion: 2\nguid: 649bedfe243624550953701819e4a256\nfolderAsset: yes\ntimeCreated: 1466621268\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Code.meta",
    "content": "fileFormatVersion: 2\nguid: 346fd47a331c84b6faa3f6260e3ab4f4\nfolderAsset: yes\ntimeCreated: 1466621268\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Editor/Bon/BonCanvas.cs",
    "content": "﻿using System;\nusing System.ComponentModel;\nusing System.Net.NetworkInformation;\nusing System.Security.Cryptography;\nusing UnityEditor;\nusing UnityEngine;\nusing Assets.Code.Bon;\n\nnamespace Assets.Editor.Bon\n{\n\t[Serializable]\n\tpublic class BonCanvas\n\t{\n\t\tpublic  GUIStyle Style = new GUIStyle();\n\n\t\tpublic const float CanvasSize = 100000;\n\n\t\tpublic string FilePath;\n\n\t\tpublic Rect DrawArea = new Rect();\n\n\t\t[SerializeField]\n\t\tpublic float Zoom = 1;\n\t\t[SerializeField]\n\t\tpublic Vector2 Position = new Vector2();\n\n\t\tpublic Graph Graph;\n\n\t\tpublic Rect TabButton = new Rect();\n\t\tpublic Rect CloseTabButton = new Rect();\n\n\t\tprivate Vector2 _tmpVector01 = new Vector2();\n\t\tprivate Vector2 _tmpVector02 = new Vector2();\n\n\t\tprivate  Color _backgroundColor = new Color(0.18f, 0.18f, 0.18f, 1f);\n\t\tprivate  Color _backgroundLineColor01 = new Color(0.14f, 0.14f, 0.14f, 1f);\n\t\tprivate  Color _backgroundLineColor02 = new Color(0.10f, 0.10f, 0.10f, 1f);\n\n\t\tprivate GUIStyle centeredLabelStyle;\n\n\t\tpublic BonCanvas(Graph graph)\n\t\t{\n\t\t\tGraph = graph;\n\t\t\tStyle.normal.background = CreateBackgroundTexture();\n\t\t\tStyle.normal.background.wrapMode = TextureWrapMode.Repeat;\n\t\t\tStyle.fixedHeight = CanvasSize;\n\t\t\tStyle.fixedWidth = CanvasSize;\n\t\t}\n\n\t\tprivate Texture2D CreateBackgroundTexture()\n\t\t{\n\t\t\tvar texture = new Texture2D(100, 100, TextureFormat.ARGB32, false);\n\t\t\tfor (var x = 0; x < texture.width; x++)\n\t\t\t{\n\t\t\t\tfor (var y = 0; y < texture.width; y++)\n\t\t\t\t{\n\t\t\t\t\tbool isVerticalLine = (x%11 == 0);\n\t\t\t\t\tbool isHorizontalLine = (y % 11 == 0);\n\t\t\t\t\tif (x == 0 || y == 0) texture.SetPixel(x, y, _backgroundLineColor02);\n\t\t\t\t\telse if (isVerticalLine || isHorizontalLine) texture.SetPixel(x, y, _backgroundLineColor01);\n\t\t\t\t\telse texture.SetPixel(x, y, _backgroundColor);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttexture.filterMode = FilterMode.Trilinear;\n\t\t\ttexture.wrapMode = TextureWrapMode.Repeat;\n\t\t\ttexture.Apply();\n\t\t\treturn texture;\n\t\t}\n\n\t\tpublic void Draw(EditorWindow window, Rect region, AbstractSocket currentDragingSocket)\n\t\t{\n\t\t\tif (centeredLabelStyle == null) centeredLabelStyle = GUI.skin.GetStyle(\"Label\");\n\t\t\tcenteredLabelStyle.alignment = TextAnchor.MiddleCenter;\n\n\t\t\tEditorZoomArea.Begin(Zoom, region);\n\n\t\t\tif (Style.normal.background == null) \tStyle.normal.background = CreateBackgroundTexture();\n\t\t\tGUI.DrawTextureWithTexCoords(DrawArea, Style.normal.background, new Rect(0, 0, 1000, 1000));\n\t\t\tDrawArea.Set(Position.x, Position.y, CanvasSize, CanvasSize);\n\t\t\tGUILayout.BeginArea(DrawArea);\n\t\t\tDrawEdges();\n\t\t\twindow.BeginWindows();\n\t\t\tDrawNodes();\n\t\t\twindow.EndWindows();\n\t\t\tDrawDragEdge(currentDragingSocket);\n\n\t\t\tfor (var i = 0; i < Graph.GetNodeCount(); i++)\n\t\t\t{\n\t\t\t\tGraph.GetNodeAt(i).GUIDrawSockets();\n\t\t\t}\n\n\t\t\tGUILayout.EndArea();\n\t\t\tEditorZoomArea.End();\n\t\t}\n\n\t\tprivate void DrawDragEdge(AbstractSocket currentDragingSocket)\n\t\t{\n\t\t\tif (currentDragingSocket != null)\n\t\t\t{\n\t\t\t\t_tmpVector01 = Edge.GetEdgePosition(currentDragingSocket, _tmpVector01);\n\t\t\t\t_tmpVector02 = Edge.GetTangentPosition(currentDragingSocket, _tmpVector01);\n\t\t\t\tEdge.DrawEdge(_tmpVector01, _tmpVector02, Event.current.mousePosition, Event.current.mousePosition,\n\t\t\t\t\tcurrentDragingSocket.Type);\n\t\t\t}\n\t\t}\n\n\t\tpublic void DrawNodes()\n\t\t{\n\t\t\tfor (var i = 0; i < Graph.GetNodeCount(); i++)\n\t\t\t{\n\t\t\t\tNode node = Graph.GetNodeAt(i);\n\t\t\t\tif (!node.Collapsed) node.WindowRect.height = node.Height;\n\t\t\t\tnode.WindowRect = GUI.Window(node.Id, node.WindowRect, GUIDrawNodeWindow, node.Name + \"\");\n\t\t\t\tif (node.Collapsed)\n\t\t\t\t{\n\t\t\t\t\t// title bar text is not visible if collapsed\n\t\t\t\t\tGUI.Label(node.WindowRect, node.Name + \"\", centeredLabelStyle);\n\t\t\t\t}\n\n\t\t\t\tnode.GUIAlignSockets();\n\t\t\t}\n\t\t}\n\n\t\tvoid GUIDrawNodeWindow(int nodeId)\n\t\t{\n\t\t\tNode node = Graph.GetNode(nodeId);\n\t\t\tnode.ContentRect.Set(0, BonConfig.SocketOffsetTop,\n\t\t\t\tnode.Width, node.Height - BonConfig.SocketOffsetTop);\n\n\t\t\tif (Event.current.type == EventType.MouseDown && Event.current.button == 1)\n\t\t\t{\n\t\t\t\tGenericMenu m = new GenericMenu();\n\t\t\t\tm.AddDisabledItem(new GUIContent(node.Name + \" (\" + nodeId + \")\"));\n\t\t\t\tm.AddSeparator(\"\");\n\t\t\t\tm.AddItem(new GUIContent(\"Delete\"), false, DeleteNode, nodeId);\n\n\t\t\t\tif (node.Collapsed) m.AddItem(new GUIContent(\"Expand\"), false, ExpandNode, nodeId);\n\t\t\t\telse m.AddItem(new GUIContent(\"Collapse\"), false, CollapseNode, nodeId);\n\n\t\t\t\tm.ShowAsContext();\n\t\t\t\tEvent.current.Use();\n\t\t\t}\n\n\t\t\tif (!node.Collapsed)\n\t\t\t{\n\t\t\t\tGUILayout.BeginArea(node.ContentRect);\n\t\t\t\tGUI.color = Color.white;\n\t\t\t\tnode.OnGUI();\n\t\t\t\tGUILayout.EndArea();\n\t\t\t}\n\n\t\t\tGUI.DragWindow();\n\t\t\tif (Event.current.GetTypeForControl(node.Id) == EventType.Used)\n\t\t\t{\n\t\t\t\tif (Node.LastFocusedNodeId != node.Id) node.OnFocus();\n\t\t\t\tNode.LastFocusedNodeId = node.Id;\n\t\t\t}\n\t\t}\n\n\t\tprivate void CollapseNode(object nodeId)\n\t\t{\n\t\t\tNode node = Graph.GetNode((int) nodeId);\n\t\t\tnode.Collapse();\n\t\t}\n\n\t\tprivate void ExpandNode(object nodeId)\n\t\t{\n\t\t\tGraph.GetNode((int) nodeId).Expand();\n\t\t}\n\n\n\t\tprivate void DeleteNode(object nodeId)\n\t\t{\n\t\t\tGraph.RemoveNode((int) nodeId);\n\t\t}\n\n\n\t\tpublic void DrawEdges()\n\t\t{\n\t\t\tfor (var i = 0; i < Graph.GetNodeCount(); i++)\n\t\t\t{\n\t\t\t\tGraph.GetNodeAt(i).GUIDrawEdges();\n\t\t\t}\n\t\t}\n\n\t\tpublic Node GetFocusedNode()\n\t\t{\n\t\t\tfor (var i = 0; i < Graph.GetNodeCount(); i++)\n\t\t\t{\n\t\t\t\tNode node = Graph.GetNodeAt(i);\n\t\t\t\tif (node.HasFocus()) return node;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\t/// <summary> Returns the socket at the window position.</summary>\n\t\t/// <param name=\"windowPosition\"> The position to get the Socket from in window coordinates</param>\n\t\t/// <returns>The socket at the posiiton or null or null.</returns>\n\t\tpublic AbstractSocket GetSocketAt(Vector2 windowPosition)\n\t\t{\n\t\t\tVector2 projectedPosition = ProjectToCanvas(windowPosition);\n\n\t\t\tfor (var i = 0; i < Graph.GetNodeCount(); i++)\n\t\t\t{\n\t\t\t\tNode node = Graph.GetNodeAt(i);\n\t\t\t\tAbstractSocket socket = node.SearchSocketAt(projectedPosition);\n\t\t\t\tif (socket != null)\n\t\t\t\t{\n\t\t\t\t\treturn socket;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\tpublic Node CreateNode(Type nodeType, Vector2 windowPosition)\n\t\t{\n\n\t\t\tNode node = (Node) Graph.CreateNode(nodeType);\n\t\t\tvar position = ProjectToCanvas(windowPosition);\n\t\t\tnode.X = position.x;\n\t\t\tnode.Y = position.y;\n\t\t\tGraph.AddNode(node);\n\t\t\treturn node;\n\t\t}\n\n\t\tpublic void RemoveFocusedNode()\n\t\t{\n\n\t\t\tNode node = GetFocusedNode();\n\t\t\tif (node != null) Graph.RemoveNode(node);\n\t\t}\n\n\t\tpublic Vector2 ProjectToCanvas(Vector2 windowPosition)\n\t\t{\n\t\t\twindowPosition.y += (21) - ((BonWindow.TopOffset*2));\n\t\t\twindowPosition = windowPosition/this.Zoom;\n\t\t\twindowPosition.x -= (this.DrawArea.x);\n\t\t\twindowPosition.y -= (this.DrawArea.y);\n\t\t\treturn windowPosition;\n\t\t}\n\t}\n\n\n\n}\n\n\n"
  },
  {
    "path": "Assets/Editor/Bon/BonCanvas.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 10bc549630a4a4a1aae204e1b20e5b35\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Editor/Bon/EditorZoomArea.cs",
    "content": "﻿using UnityEngine;\n\n/**\n\n\t\tThis class helps zooming in an editor window\n\t\tBased on http://martinecker.com/martincodes/unity-editor-window-zooming/\n\n**/\nnamespace Assets.Editor.Bon\n{\n\tpublic class EditorZoomArea\n\t{\n\n\t\tprivate static Matrix4x4 _prevGuiMatrix;\n\t\tprivate static Vector3 _tmpScaleVector = new Vector3();\n\t\tprivate static Rect _tmpRect = new Rect();\n\n\t\tpublic static Rect Begin(float zoomScale, Rect screenCoordsArea)\n\t\t{\n\t\t\tGUI.EndGroup();\n\t\t\tRect clippedArea = screenCoordsArea.ScaleSizeBy(1.0f / zoomScale, screenCoordsArea.TopLeft());\n\t\t\tclippedArea.y += BonWindow.TopOffset;\n\t\t\tGUI.BeginGroup(clippedArea);\n\t\t\t_prevGuiMatrix = GUI.matrix;\n\t\t\tMatrix4x4 translation = Matrix4x4.TRS(clippedArea.TopLeft(), Quaternion.identity, Vector3.one);\n\t\t\t_tmpScaleVector.Set(zoomScale, zoomScale, 1.0f);\n\t\t\tMatrix4x4 scale = Matrix4x4.Scale(_tmpScaleVector);\n\t\t\tGUI.matrix = translation * scale * translation.inverse * GUI.matrix;\n\t\t\treturn clippedArea;\n\t\t}\n\n\t\tpublic static void End()\n\t\t{\n\t\t\tGUI.matrix = _prevGuiMatrix;\n\t\t\tGUI.EndGroup();\n\t\t\t_tmpRect.Set(0, BonWindow.TopOffset, Screen.width, Screen.height);\n\t\t\tGUI.BeginGroup(_tmpRect);\n\t\t}\n\t}\n}"
  },
  {
    "path": "Assets/Editor/Bon/EditorZoomArea.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1e71706962804461ca0510b04bf52324\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Editor/Bon/RectExtensions.cs",
    "content": "﻿using UnityEngine;\n\n/**\n\t\tThis class extends the funcitonality of a rectangle.\n\t\tBased on http://martinecker.com/martincodes/unity-editor-window-zooming/\n**/\nnamespace Assets.Editor.Bon\n{\n\tpublic static class RectExtensions\n\t{\n\n\t\tprivate static Vector2 _tmpTopLeft = new Vector2();\n\n\t\tpublic static Vector2 TopLeft(this Rect rect)\n\t\t{\n\t\t\t_tmpTopLeft.Set(rect.xMin, rect.yMin);\n\t\t\treturn _tmpTopLeft;\n\t\t}\n\n\t\tpublic static Rect ScaleSizeBy(this Rect rect, float scale)\n\t\t{\n\t\t\treturn rect.ScaleSizeBy(scale, rect.center);\n\t\t}\n\n\t\tpublic static Rect ScaleSizeBy(this Rect rect, float scale, Vector2 pivotPoint)\n\t\t{\n\t\t\tRect result = rect;\n\t\t\tresult.x -= pivotPoint.x;\n\t\t\tresult.y -= pivotPoint.y;\n\t\t\tresult.xMin *= scale;\n\t\t\tresult.xMax *= scale;\n\t\t\tresult.yMin *= scale;\n\t\t\tresult.yMax *= scale;\n\t\t\tresult.x += pivotPoint.x;\n\t\t\tresult.y += pivotPoint.y;\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static Rect ScaleSizeBy(this Rect rect, Vector2 scale)\n\t\t{\n\t\t\treturn rect.ScaleSizeBy(scale, rect.center);\n\t\t}\n\n\t\tpublic static Rect ScaleSizeBy(this Rect rect, Vector2 scale, Vector2 pivotPoint)\n\t\t{\n\t\t\tRect result = rect;\n\t\t\tresult.x -= pivotPoint.x;\n\t\t\tresult.y -= pivotPoint.y;\n\t\t\tresult.xMin *= scale.x;\n\t\t\tresult.xMax *= scale.x;\n\t\t\tresult.yMin *= scale.y;\n\t\t\tresult.yMax *= scale.y;\n\t\t\tresult.x += pivotPoint.x;\n\t\t\tresult.y += pivotPoint.y;\n\t\t\treturn result;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/Editor/Bon/RectExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ada984af67e5f4e7f8aed9e8f259049f\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Editor/Bon.meta",
    "content": "fileFormatVersion: 2\nguid: dee614b21f6be490f9d087cc50e01050\nfolderAsset: yes\ntimeCreated: 1466621268\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Editor/BonWindow.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing UnityEditor;\nusing UnityEngine;\nusing Assets.Code.Bon;\nusing Assets.Code.Bon.Socket;\nusing Assets.Editor.Bon;\nusing System.Linq;\n\n\nnamespace Assets.Editor\n{\n\t/// <summary>\n\t/// This class contains the logic of the editor window. It contains canvases that\n\t/// are containing graphs. It uses the BonLauncher to load, save and close Graphs.\n\t/// </summary>\n\tpublic class BonWindow : EditorWindow\n\t{\n\t\tprivate const string Name = \"BrotherhoodOfNode\";\n\t\tpublic const int TopOffset = 32;\n\t\tpublic const int BottomOffset = 20;\n\t\tpublic const int TopMenuHeight = 20;\n\n\n\t\tprivate const int TabButtonWidth = 200;\n\t\tprivate const int TabButtonMargin = 4;\n\t\tprivate const int TabCloseButtonSize = TopMenuHeight;\n\n\t\tprivate const int WindowTitleHeight = 21;\n\t\tprivate const float CanvasZoomMin = 0.1f;\n\t\tprivate const float CanvasZoomMax = 1.0f;\n\n\t\tprivate  Rect _openButtonRect = new Rect(0, 0, 80, TopMenuHeight);\n\t\tprivate  Rect _saveButtonRect = new Rect(80, 0, 80, TopMenuHeight);\n\t\tprivate  Rect _newButtonRect = new Rect(160, 0, 80, TopMenuHeight);\n\t\tprivate  Rect _helpButtonRect = new Rect(240, 0, 80, TopMenuHeight);\n\n\t\tprivate Vector2 _nextTranlationPosition;\n\n\t\tprivate Color _tabColorUnselected = new Color(0.8f, 0.8f, 0.8f, 0.5f);\n\t\tprivate Color _tabColorSelected = Color.white;\n\n\n\t\tprivate  List<BonCanvas> _canvasList = new List<BonCanvas>();\n\t\tprivate BonCanvas _currentCanvas;\n\t\tprivate Rect _canvasRegion = new Rect();\n\n\t\tprivate AbstractSocket _dragSourceSocket = null;\n\t\tprivate Vector2 _lastMousePosition;\n\n\t\tprivate GenericMenu _menu;\n\t\tprivate Dictionary<string, Type> _menuEntryToNodeType;\n\n\t\tprivate Rect _tmpRect = new Rect();\n\n\n\t\t[MenuItem(\"Window/\" + Name)]\n\t\tstatic void OnCreateWindow()\n\t\t{\n\t\t\tBonWindow window = GetWindow<BonWindow>();\n\t\t\t// BonWindow window = CreateInstance<BonWindow>(); // to create a new window\n\t\t\twindow.Show();\n\t\t}\n\n\t\tpublic void OnEnable()\n\t\t{\n\t\t\tInit();\n\t\t}\n\n\t\tpublic void Init()\n\t\t{\n\n\t\t\tEditorApplication.playmodeStateChanged = OnPlaymodeStateChanged;\n\t\t\t// create GameObject and the Component if it is not added to the scene\n\n\t\t\ttitleContent = new GUIContent(Name);\n\t\t\twantsMouseMove = true;\n\t\t\tEventManager.TriggerOnWindowOpen();\n\t\t\t_menuEntryToNodeType = CreateMenuEntries();\n\t\t\t_menu = CreateGenericMenu();\n\n\t\t\t_canvasList.Clear();\n\t\t\t_currentCanvas = null;\n\n\t\t\tif (GetLauncher().Graphs.Count > 0) LoadCanvas(GetLauncher().Graphs);\n\t\t\telse LoadCanvas(GetLauncher().LoadGraph(BonConfig.DefaultGraphName));\n\t\t\tUpdateGraphs();\n\t\t\tRepaint();\n\t\t}\n\n\t\tprivate void OnPlaymodeStateChanged()\n\t\t{\n\t\t\tUpdateGraphs();\n\t\t\tRepaint();\n\t\t}\n\n\t\tprivate void UpdateGraphs()\n\t\t{\n\t\t\tforeach (var graph in GetLauncher().Graphs)\n\t\t\t{\n\t\t\t\tgraph.ForceUpdateNodes();\n\t\t\t}\n\t\t}\n\n\t\tprivate void LoadCanvas(List<Graph> graphs)\n\t\t{\n\t\t\tforeach (var graph in graphs) LoadCanvas(graph);\n\t\t}\n\n\t\tprivate void LoadCanvas(Graph graph)\n\t\t{\n\t\t\t_currentCanvas = new BonCanvas(graph);\n\t\t\t_canvasList.Add(_currentCanvas);\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Creates a dictonary that maps a menu entry string to a node type using reflection.\n\t\t/// </summary>\n\t\t/// <returns>\n\t\t/// Dictonary that maps a menu entry string to a node type\n\t\t/// </returns>\n\t\tpublic Dictionary<string, Type> CreateMenuEntries()\n\t\t{\n\t\t\tDictionary<string, Type> menuEntries = new Dictionary<string, Type>();\n\n\t\t\tIEnumerable<Type> classesExtendingNode = Assembly.GetAssembly(typeof(Node)).GetTypes()\n\t\t\t\t.Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(Node)));\n\n\t\t\tforeach (Type type in classesExtendingNode) menuEntries.Add(GetItemMenuName(type), type);\n\n\t\t\tmenuEntries.OrderBy(x => x.Key);\n\t\t\treturn menuEntries;\n\t\t}\n\n\t\tprivate string GetItemMenuName(Type type)\n\t\t{\n\t\t\tstring path = Node.GetNodePath(type);\n\t\t\tif (path != null) return path + \"/\" + Node.GetNodeName(type);\n\t\t\treturn Node.GetNodeName(type);\n\t\t}\n\n\n\t\tprivate BonLauncher GetLauncher()\n\t\t{\n\t\t\tif (GameObject.Find(BonConfig.GameObjectName) == null)\n\t\t\t{\n\t\t\t\tnew GameObject(BonConfig.GameObjectName);\n\t\t\t\tLog.Info(\"Created GameObject '\" + BonConfig.GameObjectName + \"'\");\n\t\t\t}\n\t\t\tif (GameObject.Find(BonConfig.GameObjectName).GetComponent<BonLauncher>() == null)\n\t\t\t{\n\t\t\t\tLog.Info(\"Added BonLauncher component to the GameObject '\" + BonConfig.GameObjectName + \"'\");\n\t\t\t\tGameObject.Find(BonConfig.GameObjectName).AddComponent<BonLauncher>();\n\t\t\t}\n\t\t\treturn GameObject.Find(BonConfig.GameObjectName).GetComponent<BonLauncher>();\n\t\t}\n\n\t\t/// <summary>Draws the UI</summary>\n\t\tvoid OnGUI()\n\t\t{\n\t\t\tHandleCanvasTranslation();\n\t\t\tHandleDragAndDrop();\n\n\t\t\tif (Event.current.type == EventType.ContextClick)\n\t\t\t{\n\t\t\t\t_menu.ShowAsContext();\n\t\t\t\tEvent.current.Use();\n\t\t\t}\n\t\t\tHandleMenuButtons();\n\n\t\t\tif (GetLauncher() == null) return;\n\n\t\t\tHandleTabButtons();\n\n\t\t\tif (_currentCanvas != null) {\n\t\t\t\tfloat infoPanelY = Screen.height - TopOffset - 6;\n\t\t\t\t_tmpRect.Set(5, infoPanelY, 70, 20);\n\t\t\t\tGUI.Label(_tmpRect, \"zoom: \" + Math.Round(_currentCanvas.Zoom, 1));\n\t\t\t\t_tmpRect.Set(60, infoPanelY, 70, 20);\n\t\t\t\tGUI.Label(_tmpRect, \"x: \" + Math.Round(_currentCanvas.Position.x));\n\t\t\t\t_tmpRect.Set(130, infoPanelY, 70, 20);\n\t\t\t\tGUI.Label(_tmpRect, \"y: \" + Math.Round(_currentCanvas.Position.y));\n\t\t\t\t_tmpRect.Set(200, infoPanelY, 70, 20);\n\t\t\t\tGUI.Label(_tmpRect, \"nodes: \" + _currentCanvas.Graph.GetNodeCount());\n\t\t\t}\n\n\t\t\tif (_currentCanvas != null)\n\t\t\t{\n\t\t\t\t_canvasRegion.Set(0, TopOffset, Screen.width, Screen.height - 2 * TopOffset - BottomOffset);\n\t\t\t\t_currentCanvas.Draw((EditorWindow) this, _canvasRegion, _dragSourceSocket);\n\t\t\t}\n\t\t\t_lastMousePosition = Event.current.mousePosition;\n\n\t\t\tRepaint();\n\t\t}\n\n\t\tprivate void HandleTabButtons()\n\t\t{\n\t\t\tColor standardBackgroundColor = GUI.backgroundColor;\n\t\t\tint tabIndex = 0;\n\t\t\tBonCanvas canvasToClose = null;\n\t\t\tforeach (BonCanvas tmpCanvas in _canvasList)\n\t\t\t{\n\t\t\t\tint width = TabButtonWidth + TabButtonMargin + TabCloseButtonSize;\n\t\t\t\tint xOffset = width*tabIndex;\n\n\t\t\t\ttmpCanvas.TabButton.Set(xOffset, TopMenuHeight + TabButtonMargin,TabButtonWidth, TopMenuHeight);\n\t\t\t\ttmpCanvas.CloseTabButton.Set(xOffset + width - TabCloseButtonSize - TabButtonMargin -4,\n\t\t\t\t\tTopMenuHeight + TabButtonMargin, TabCloseButtonSize, TabCloseButtonSize);\n\n\t\t\t\tbool isSelected = (_currentCanvas == tmpCanvas);\n\t\t\t\tstring tabName = tmpCanvas.Graph.Name;\n\t\t\t\t//tabName = Path.GetFileName(tmpCanvas.FilePath);\n\n\t\t\t\tif (isSelected) GUI.backgroundColor = _tabColorSelected;\n\t\t\t\telse GUI.backgroundColor = _tabColorUnselected;\n\n\t\t\t\tif (GUI.Button(tmpCanvas.TabButton, tabName))\n\t\t\t\t{\n\t\t\t\t\tSetCurrentCanvas(tmpCanvas);\n\t\t\t\t}\n\t\t\t\tif (isSelected)\n\t\t\t\t{\n\t\t\t\t\tif (GUI.Button(tmpCanvas.CloseTabButton, \"X\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tcanvasToClose = tmpCanvas;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttabIndex++;\n\t\t\t}\n\n\t\t\tGUI.backgroundColor = standardBackgroundColor;\n\t\t\tif (canvasToClose != null) \tCloseCanvas(canvasToClose);\n\t\t}\n\n\t\tprivate void SetCurrentCanvas(BonCanvas canvas)\n\t\t{\n\t\t\tUpdateGraphs();\n\t\t\tRepaint();\n\t\t\tif (canvas != null) EventManager.TriggerOnFocusGraph(canvas.Graph);\n\t\t\t_currentCanvas = canvas;\n\t\t}\n\n\t\tprivate void CloseCanvas(BonCanvas canvas)\n\t\t{\n\t\t\tbool doSave = EditorUtility.DisplayDialog(\"Do you want to save.\", \"Do you want to save the graph \" + canvas.FilePath + \" ?\",\n\t\t\t\t\"Yes\", \"No\");\n\t\t\tif (doSave)\n\t\t\t{\n\t\t\t\tif (canvas.FilePath == null) OpenSaveDialog();\n\t\t\t\telse GetLauncher().SaveGraph(canvas.Graph, canvas.FilePath);\n\t\t\t}\n\t\t\tEventManager.TriggerOnCloseGraph(canvas.Graph);\n\t\t\tGetLauncher().RemoveGraph(canvas.Graph);\n\t\t\t_canvasList.Remove(canvas);\n\t\t\tif (_canvasList.Count > 0) SetCurrentCanvas(_canvasList[0]);\n\t\t\telse SetCurrentCanvas(null);\n\t\t}\n\n\t\tprivate GenericMenu CreateGenericMenu()\n\t\t{\n\t\t\tGenericMenu m = new GenericMenu();\n\t\t\tforeach(KeyValuePair<string, Type> entry in _menuEntryToNodeType)\n\t\t\t\tm.AddItem(new GUIContent(entry.Key), false, OnGenericMenuClick, entry.Value);\n\t\t\treturn m;\n\t\t}\n\n\t\tprivate void OnGenericMenuClick(object item)\n\t\t{\n\t\t\tif (_currentCanvas != null)\n\t\t\t{\n\t\t\t\t_currentCanvas.CreateNode((Type) item, _lastMousePosition);\n\t\t\t}\n\t\t}\n\n\t\tprivate void CreateCanvas(string path)\n\t\t{\n\t\t\tBonCanvas canvas;\n\t\t\tif (path != null) canvas = new BonCanvas(GetLauncher().LoadGraph(path));\n\t\t\telse canvas = new BonCanvas(GetLauncher().LoadGraph(BonConfig.DefaultGraphName));\n\t\t\tcanvas.FilePath = path;\n\t\t\t_canvasList.Add(canvas);\n\t\t\tSetCurrentCanvas(canvas);\n\t\t}\n\n\t\tprivate void OpenSaveDialog()\n\t\t{\n\t\t\tvar path = EditorUtility.SaveFilePanel(\"save graph data\", \"\", \"graph\", \"json\");\n\t\t\tif (!path.Equals(\"\"))\n\t\t\t{\n\t\t\t\tGetLauncher().SaveGraph(_currentCanvas.Graph, path);\n\t\t\t\t_currentCanvas.FilePath = path;\n\t\t\t}\n\t\t}\n\n\t\tprivate void HandleMenuButtons()\n\t\t{\n\t\t\tif (GUI.Button(_openButtonRect, \"Open\"))\n\t\t\t{\n\t\t\t\tvar path = EditorUtility.OpenFilePanel(\"load graph data\", \"\", \"json\");\n\t\t\t\tif (!path.Equals(\"\")) CreateCanvas(path);\n\t\t\t}\n\n\t\t\t// Save Button\n\t\t\tif (GUI.Button(_saveButtonRect, \"Save\")) OpenSaveDialog();\n\t\t\t// New Button\n\t\t\tif (GUI.Button(_newButtonRect, \"New\")) CreateCanvas(null);\n\t\t\t// Help Button\n\t\t\tGUI.Button(_helpButtonRect, \"Help\");\n\t\t}\n\n\n\t\tprivate void HandleCanvasTranslation()\n\t\t{\n\t\t\tif (_currentCanvas == null) return;\n\n\t\t\t// Zoom\n\t\t\tif (Event.current.type == EventType.ScrollWheel)\n\t\t\t{\n\t\t\t\tVector2 zoomCoordsMousePos = ConvertScreenCoordsToZoomCoords(Event.current.mousePosition);\n\t\t\t\tfloat zoomDelta = -Event.current.delta.y/150.0f;\n\t\t\t\tfloat oldZoom = _currentCanvas.Zoom;\n\t\t\t\t_currentCanvas.Zoom = Mathf.Clamp(_currentCanvas.Zoom + zoomDelta, CanvasZoomMin, CanvasZoomMax);\n\n\t\t\t\t_nextTranlationPosition = _currentCanvas.Position + (zoomCoordsMousePos - _currentCanvas.Position) -\n\t\t\t\t\t(oldZoom/_currentCanvas.Zoom)*(zoomCoordsMousePos - _currentCanvas.Position);\n\n\t\t\t\tif (_nextTranlationPosition.x >= 0) _nextTranlationPosition.x = 0;\n\t\t\t\tif (_nextTranlationPosition.y >= 0) _nextTranlationPosition.y = 0;\n\t\t\t\t_currentCanvas.Position = _nextTranlationPosition;\n\t\t\t\tEvent.current.Use();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Translate\n\t\t\tif (Event.current.type == EventType.MouseDrag &&\n\t\t\t    (Event.current.button == 0 && Event.current.modifiers == EventModifiers.Alt) ||\n\t\t\t    Event.current.button == 2)\n\t\t\t{\n\t\t\t\tVector2 delta = Event.current.delta;\n\t\t\t\tdelta /= _currentCanvas.Zoom;\n\n\t\t\t\t_nextTranlationPosition = _currentCanvas.Position + delta;\n\t\t\t\tif (_nextTranlationPosition.x >= 0) _nextTranlationPosition.x = 0;\n\t\t\t\tif (_nextTranlationPosition.y >= 0) _nextTranlationPosition.y = 0;\n\n\t\t\t\t_currentCanvas.Position = _nextTranlationPosition;\n\t\t\t\tEvent.current.Use();\n\t\t\t}\n\t\t}\n\n\t\tprivate void HandleSocketDrag(AbstractSocket dragSource)\n\t\t{\n\t\t\tif (dragSource != null)\n\t\t\t{\n\t\t\t\tif (dragSource.IsInput() && dragSource.IsConnected())\n\t\t\t\t{\n\t\t\t\t\t_dragSourceSocket = ((InputSocket) dragSource).Edge.GetOtherSocket(dragSource);\n\t\t\t\t\t_currentCanvas.Graph.UnLink((InputSocket) dragSource, (OutputSocket) _dragSourceSocket);\n\t\t\t\t}\n\t\t\t\tif (dragSource.IsOutput()) _dragSourceSocket = dragSource;\n\t\t\t\tEvent.current.Use();\n\t\t\t}\n\t\t\tRepaint();\n\t\t}\n\n\t\tprivate void HandleSocketDrop(AbstractSocket dropTarget)\n\t\t{\n\t\t\tif (dropTarget != null && dropTarget.GetType() != _dragSourceSocket.GetType())\n\t\t\t{\n\t\t\t\tif (dropTarget.IsInput())\n\t\t\t\t{\n\t\t\t\t\t_currentCanvas.Graph.Link((InputSocket) dropTarget, (OutputSocket) _dragSourceSocket);\n\t\t\t\t}\n\t\t\t\tEvent.current.Use();\n\t\t\t}\n\t\t\t_dragSourceSocket = null;\n\t\t\tRepaint();\n\t\t}\n\n\t\tprivate void HandleDragAndDrop()\n\t\t{\n\t\t\tif (_currentCanvas == null) return;\n\n\t\t\tif (Event.current.type == EventType.MouseDown)\n\t\t\t{\n\t\t\t\tHandleSocketDrag(_currentCanvas.GetSocketAt(Event.current.mousePosition));\n\t\t\t}\n\n\t\t\tif (Event.current.type == EventType.MouseUp && _dragSourceSocket != null)\n\t\t\t{\n\t\t\t\tHandleSocketDrop(_currentCanvas.GetSocketAt(Event.current.mousePosition));\n\t\t\t}\n\n\t\t\tif (Event.current.type == EventType.MouseDrag)\n\t\t\t{\n\t\t\t\tif (_dragSourceSocket != null) Event.current.Use();\n\t\t\t}\n\t\t}\n\n\t\tprivate Vector2 ConvertScreenCoordsToZoomCoords(Vector2 screenCoords)\n\t\t{\n\t\t\treturn (screenCoords - _canvasRegion.TopLeft())/_currentCanvas.Zoom + _currentCanvas.Position;\n\t\t}\n\n\t}\n}\n\n\n"
  },
  {
    "path": "Assets/Editor/BonWindow.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d0e35861c4d634e37bac44b54a6fa54c\ntimeCreated: 1466621268\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 87d3b5ebc92f9420784d5748ca012ae8\nfolderAsset: yes\ntimeCreated: 1466621268\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Untitled.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 75deddd5a4dcb4e79a064a646b245523\ntimeCreated: 1466621268\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "LICENSE.txt",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2016 Luca Hofmann\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "ProjectSettings/ProjectVersion.txt",
    "content": "m_EditorVersion: 5.3.5p5\nm_StandardAssetsVersion: 0\n"
  },
  {
    "path": "README.md",
    "content": "An improved version of this software is available at the Unity Asset Store: https://www.assetstore.unity3d.com/#!/content/72081\nI am thinking about to open source the improved tool and deprecate BoN. The time investment would only make sense to me if there would be developers to contribute on GDI.\n\n# BrotherhoodOfNode\nA visual graph editor for Unity3D\n\n![alt text](https://github.com/aphex-/BrotherhoodOfNode/blob/master/preview.png \"math Nodes preview\")\n\n![alt text](https://github.com/aphex-/BrotherhoodOfNode/blob/master/noise_preview.png \"noise Nodes preview\")\n\n### Install\n\n#### This project is still under development... But you can use it already!\n\n1. copy the files from the asset folder to your unity project asset folder\n2. in unity click on window->BrotherhoodOfNode to open the editor window\n3. continue reading and afterwards take a look at Assets.Code.Bon.BonLauncher.cs to learn how the project works\n4. help us make it even better\n\n### Features\n* user friendly editor UI\n* human readable JSON serialization of the graph\n* easy creation of custom nodes (extend Node.cs)\n* tab pages for multiple graphs\n* noise creation/manipulation, color gradient, point scattering, masking\n\n![alt text](https://github.com/aphex-/BrotherhoodOfNode/blob/master/feature_preview.gif \"feature preview\")\n\n### Non-Features\n* ~~nothing but a tool to create graphs and make them persitent (ok.. there are some math related Nodes now..)~~\nOk.. there are several useful node types now.. \n\n\n### Usage\nRight click to add a node. Middle mouse button to scroll. Right click on a node to delete a node. Click/Drag to connect Sockets. Mouse wheel to zoom.\n\n\n\n## How To Create A Custom Node\nTo create your own nodes you need to create a new class. Let's call it MyNode.cs\nfor this example. **MyNode** now needs to inherit from the class **Node** (or from its abstract subclasses). And this \nclass needs the annotation **[Serializable]** in order to save it as a json file.\n\nNotice that our **Node** is extending **AbstractNumberNode** and contains an **OutputSocket** for numbers.\n\n```cs\nusing System;\nusing UnityEngine;\n\nnamespace Assets.Code.Bon.Graph.Custom\n{\n\t[Serializable]\n\t[GraphContextMenuItem(\"Standard\", \"MyNode\")]\n\tpublic class MyNode : AbstractNumberNode {\n\n\t\t[SerializeField]\n\t\tprivate int myNumber;\n\n\t\tpublic MyNode(int id, Graph parent) : base(id, parent)\n\t\t{\n\t\t\t// Add the input / output sockets of this Node\n\t\t\tSockets.Add(new OutputSocket(this, typeof(AbstractNumberNode));\n\t\t\tSockets.Add(new InputSocket(this, typeof(AbstractColorNode));\n\t\t\tSockets.Add(new InputSocket(this, typeof(AbstractNumberNode));\n\t\t\tHeight = 65;\n\t\t}\n\n\t\t// To create your custom UI elements in the Node.\n\t\tpublic override void OnGUI()\n\t\t{\n\t\t\t// Use GUI or GUILayout as usual\n\t\t\t// (if your nodes content has changed call: TriggerChangeEvent())\n\t\t}\n\t\t\n\t\t// This method comes from the AbstractNumberNode. It makes sure that all classes of\n\t\t// this type can return a number. Return your number here depending on the parameters.\n\t\t// Your number is usually also depending on the InputSockets of this Node. The assigned\n\t\t// OutputSocket can be igrnored as long as you only have one output.\n\t\tpublic override float GetNumber(OutputSocket outSocket, float x, float y, float z, float seed)\n\t\t{\n\t\t\treturn myNumber;\n\t\t}\n\t\n\n\t}\n}\n```\nThe anotation **[GraphContextMenuItem]** tells the editor where to add the menu entry for our **Node**.\n\n\n### Add UI elememts\nTo add custom UI elements to your node simply use the **OnGUI** method as usual.\n\n## How To Receive Graph Events\nThe editor (now) uses the **EventManager** and its static methods to trigger events.\nTo receive the events simply subscribe to the **EventManager**. \n```cs\n\tpublic Awake()\n\t{\n\t\tEventManager.OnCreateGraph += OnCreate;\n\t\tEventManager.OnChangedNode += OnNodeChanged;\n\t\t// .. there are more events\n\t}\n\n\tpublic void OnCreate(Graph graph)\n\t{\n\t\tDebug.Log(\"OnCreateGraph\");\n\t\tgraph.UpdateNodes();\n\t}\n\n\tpublic void OnNodeChanged(Graph graph, Node node)\n\t{\n\t\tDebug.Log(\"OnNodeChanged: Node \" + node.GetType() + \" with id \" + node.Id);\n\t\tgraph.ForceUpdateNodes();\n\t}\n```\n\n## How To Update The Graphs\nYou can find the standard implementation for updating the Graphs in the **StandardGraphController**. This class subscribes to the *EventManager* to update the Graph on the events. You maybe want to extend its logic to also update objects in your scene. You could also alter the update mechanism or something.\n\n### Save nodes as json (serialization / deserializaiton)\nIf we have got class members (like myNumber) we want to make persistent\nwe need to prefix the annotation **[SerializeField]**\nto it. You may also need **[System.NonSerialized]** to avoid serialization for your memners.\nAlso take a look at: http://docs.unity3d.com/Manual/JSONSerialization.html\nIf you really need a more complex way to serialize your **Node** you can use\nthe methods **OnSerialization** and **OnDeserialization** to add your logic.\n\n\n### Next Up..\n* Remove the tab-pages and implement the possibility of multiple editor windows\n* Unit tests\n* A help dialog to explain the controls.\n* Code style and code documentation (no idea whats the state of the art. Following microsofts or unitys recommendations?)\n\n"
  }
]