Esempio n. 1
0
 public DummyRouteFinder(Vector3 start, TestRoute startRoute, Vector3 end, TestRoute endRoute)
 {
     this.start    = start;
     this.mR0      = startRoute;
     this.end      = end;
     this.endRoute = endRoute;
 }
Esempio n. 2
0
        private TestRoute TR(int level, TestRouteColumn col, TestRoute source = null)
        {
            var route = new TestRoute(level, col);

            if (source != null)
            {
                source.Connect(route);
            }
            return(route);
        }
Esempio n. 3
0
        private Vector3 getPoint(TestRoute mR5, float progress, float side)
        {
            var start = mR5.StartPosition;
            var end   = mR5.EndPosition;
            var dir   = (end - start).normalized;

            var sideVector = Vector3.Cross(Vector3.up, dir) * side;

            return(Vector3.Lerp(start, end, progress) + sideVector);
        }
Esempio n. 4
0
        private TestPath TP(TestRoute route, TestPath source = null)
        {
            var p = new TestPath(route, source, route.Paths.Count());

            route.Add(p);
            if (source != null)
            {
                source.Connect(p);
            }
            return(p);
        }
Esempio n. 5
0
        public TestPath(TestRoute route, TestPath source, int index)
        {
            this.route = route;

            var dir = (route.EndPosition - route.StartPosition).normalized;


            LoftPath        = new LinearPath(route.StartPosition, route.EndPosition);
            SideOffsetStart = source == null ? index * 2 : source.SideOffsetEnd;
            SideOffsetEnd   = index * 2;
            Index           = index;
        }
Esempio n. 6
0
        private void TestRoute(TestRoute from, TestRoute to, TestRoute[] array)
        {
            var solver = new RouteSolver(new[] { from }, new[] { to });

            while (solver.Iterate())
            {
            }

            Assert.IsTrue(solver.IsComplete);
            Assert.IsTrue(solver.IsSuccess);

            CollectionAssert.AreEqual(array, solver.Solution.ToArray());
            r.HighlightRoute(array);
        }
Esempio n. 7
0
        private void addToGraph(TestRoute mR0, GraphViz graph, GraphViz pathsGraph)
        {
            graph.Add(mR0.GetName());
            graph.SetGroup("level" + mR0.Level, mR0.GetName());
            foreach (TestRoute next in mR0.NextRoutes)
            {
                graph.Connect(mR0.GetName(), next.GetName());
                addToGraph(next, graph, pathsGraph);
            }

            foreach (TestPath path in mR0.Paths)
            {
                pathsGraph.SetGroup(mR0.GetName(), path.GetName());
                var left = path.LeftParralel as TestPath;
                if (left != null)
                {
                    pathsGraph.Connect(path.GetName(), left.GetName());
                }
                var right = path.RightParralel as TestPath;
                if (right != null)
                {
                    pathsGraph.Connect(path.GetName(), right.GetName());
                }
                foreach (TestPath next in path.NextPaths)
                {
                    pathsGraph.Connect(path.GetName(), next.GetName(), new Dictionary <string, string>()
                    {
                        { "style", "bold" }
                    });

                    left = next.LeftParralel as TestPath;
                    if (left != null)
                    {
                        pathsGraph.Connect(path.GetName(), left.GetName(), new Dictionary <string, string>()
                        {
                            { "style", "dotted" }
                        }, overwrite: false);
                    }
                    right = next.RightParralel as TestPath;
                    if (right != null)
                    {
                        pathsGraph.Connect(path.GetName(), right.GetName(), new Dictionary <string, string>()
                        {
                            { "style", "dotted" }
                        }, overwrite: false);
                    }
                }
            }
        }
Esempio n. 8
0
        internal void HighlightRoute(IEnumerable <TestRoute> array)
        {
            var colorDict = new Dictionary <string, string> {
                { "color", "red" }
            };
            TestRoute prev = null;

            foreach (TestRoute item in array)
            {
                routesGraph.Add(item.GetName(), colorDict);
                pathsGraph.GroupDetails(item.GetName(), colorDict);
                if (prev != null)
                {
                    routesGraph.Connect(prev.GetName(), item.GetName(), colorDict);
                }
                prev = item;
            }
        }
Esempio n. 9
0
        public RouteData()
        {
            var fl = TestRouteColumn.FarLeft;
            var l  = TestRouteColumn.Left;
            var m  = TestRouteColumn.Middle;
            var r  = TestRouteColumn.Right;
            var fr = TestRouteColumn.FarRight;

            // 0
            mR0 = TR(0, m);

            mR0P0 = TP(mR0);
            mR0P1 = TP(mR0);
            mR0P2 = TP(mR0);

            // 1
            lR1 = TR(1, l, mR0);
            mR1 = TR(1, m, mR0);

            lR1P0 = TP(lR1, mR0P0);
            mR1P0 = TP(mR1, mR0P1);
            mR1P1 = TP(mR1, mR0P2);

            // 2
            lR2 = TR(2, l, lR1);

            lR2P0 = TP(lR2, lR1P0);

            mR2   = TR(2, m, mR1);
            mR2P0 = TP(mR2, mR1P0);


            rR2   = TR(2, r, mR1);
            rR2P0 = TP(rR2, mR1P1);

            // 3
            lR3 = TR(3, l, lR2);

            lR3P0 = TP(lR3, lR2P0);
            lR3P1 = TP(lR3, lR2P0);

            mR3   = TR(3, m, mR2);
            mR3P0 = TP(mR3, mR2P0);
            mR3P1 = TP(mR3, mR2P0);

            rR3   = TR(3, r, rR2);
            rR3P0 = TP(rR3, rR2P0);
            rR3P1 = TP(rR3, rR2P0);

            // 4

            flR4 = TR(4, fl, lR3);

            flR4P0 = TP(flR4, lR3P0);

            lR4 = TR(4, l, lR3);

            lR4P0 = TP(lR4, lR3P1);

            mR4   = TR(4, m, mR3);
            mR4P0 = TP(mR4, mR3P0);
            mR4P1 = TP(mR4, mR3P1);

            frR4 = TR(4, fr, rR3);

            frR4P0 = TP(frR4, rR3P0);
            frR4P1 = TP(frR4, rR3P1);

            // 5

            flR5 = TR(5, fl, flR4);

            flR5P0 = TP(flR5, flR4P0);

            lR5 = TR(5, l, lR4);

            lR5P0 = TP(lR5, lR4P0);
            lR5P1 = TP(lR5, lR4P0);

            mR5 = TR(5, m, mR4);

            mR5P0 = TP(mR5, mR4P0);
            mR5P1 = TP(mR5, mR4P1);

            rR5   = TR(5, r, mR4);
            rR5P0 = TP(rR5, mR4P1);

            frR5   = TR(5, fr, frR4);
            frR5P0 = TP(frR5, frR4P0);
            frR5P1 = TP(frR5, frR4P1);



            inputRoutes = new[] { mR0 };
            inputPaths  = new[] { mR0P0, mR0P1, mR0P2 };

            outputRoutes = new[] { flR5, lR5, mR5, rR5, frR5 };
            outputPaths  = new[] { flR5P0, lR5P0, lR5P1, mR5P0, mR5P1, rR5P0, frR5P0, frR5P1 };

            sequenceRight    = new[] { mR0, mR1, mR2, mR3, mR4, rR5 };
            sequenceMiddle   = new[] { mR0, mR1, mR2, mR3, mR4, mR5 };
            sequenceLeft     = new[] { mR0, lR1, lR2, lR3, lR4, lR5 };
            sequenceFarLeft  = new[] { mR0, lR1, lR2, lR3, flR4, flR5 };
            sequenceFarRight = new[] { mR0, mR1, rR2, rR3, frR4, frR5 };

            spitOutGraph();
        }
Esempio n. 10
0
 internal void Connect(TestRoute route)
 {
     route.StartPosition = EndPosition;
     routes.Add(route);
 }