コード例 #1
0
        PWMainGraph CreateTestGraph(out PWNodePerlinNoise2D perlinNode, out PWNodeDebugInfo debugNode)
        {
            var graph = PWGraphBuilder.NewGraph <PWMainGraph>()
                        .NewNode(typeof(PWNodePerlinNoise2D), "perlin")
                        .NewNode(typeof(PWNodeDebugInfo), "debug")
                        .Link("perlin", "debug")
                        .Execute()
                        .GetGraph() as PWMainGraph;

            perlinNode = graph.FindNodeByName <PWNodePerlinNoise2D>("perlin");
            debugNode  = graph.FindNodeByName <PWNodeDebugInfo>("debug");

            graph.chunkSize     = 64;
            graph.step          = .5f;
            graph.chunkPosition = new Vector3(10, 42, -7);
            graph.seed          = 123456789;

            return(graph as PWMainGraph);
        }
コード例 #2
0
        public void PerlinNoiseToDebugNodeExecution()
        {
            string perlinNodeName = "perlin";
            string debugNodeName  = "debug";
            var    graph          = PWGraphBuilder.NewGraph <PWMainGraph>()
                                    .NewNode <PWNodePerlinNoise2D>(perlinNodeName)
                                    .NewNode <PWNodeDebugInfo>(debugNodeName)
                                    .Link(perlinNodeName, debugNodeName)
                                    .Execute()
                                    .GetGraph();

            PWNodePerlinNoise2D perlinNode = graph.FindNodeByName(perlinNodeName) as PWNodePerlinNoise2D;
            PWNodeDebugInfo     debugNode  = graph.FindNodeByName(debugNodeName) as PWNodeDebugInfo;

            Assert.That(perlinNode != null, "Perlin node not found in the graph (using FindNodeByName)");
            Assert.That(debugNode != null, "Debug node not found in the graph (using FindNodeByName)");

            PWNodeLink link = perlinNode.GetOutputLinks().First();

            Assert.That(link != null, "Link can't be found in the graph");
            Assert.That(link.toNode == debugNode);
        }