Example #1
0
        public static void BiomeSurfaceGraphValidGraphOutOfBounds()
        {
            var graph = new BiomeSurfaceGraph();

            graph.BuildGraph(GenerateValidBiomeSurfaces());

            var surface10 = graph.GetSurface(-10);
            var surface99 = graph.GetSurface(99);

            Assert.That(surface10 == null);
            Assert.That(surface99 == null);
        }
Example #2
0
        public static void BiomeSurfaceGraphValidGraphBounds()
        {
            var graph = new BiomeSurfaceGraph();

            graph.BuildGraph(GenerateValidBiomeSurfaces());

            var surface0  = graph.GetSurface(0);
            var surface40 = graph.GetSurface(40);
            var surface20 = graph.GetSurface(20, 30);

            Assert.That(surface0.name == "3");
            Assert.That(surface40.name == "4" || surface40.name == "5");
            Assert.That(surface20.name == "4" || surface20.name == "5");
        }
Example #3
0
        public static void BiomeSurfaceGraphInvalidHoleGraph()
        {
            var  graph = new BiomeSurfaceGraph();
            bool valid = graph.BuildGraph(GenerateInvalidHoleBiomeSurfaces());

            Assert.That(valid == false);

            var surface10 = graph.GetSurface(10);
            var surface35 = graph.GetSurface(35);
            var surface41 = graph.GetSurface(41);

            Assert.That(surface10 == null);
            Assert.That(surface35 == null);
            Assert.That(surface41 == null);
        }
Example #4
0
        public static void BiomeSurfaceGraphValidGraph()
        {
            var graph = new BiomeSurfaceGraph();

            graph.BuildGraph(GenerateValidBiomeSurfaces());

            var surface1  = graph.GetSurface(1, 1);
            var surface21 = graph.GetSurface(21, 1);
            var surface41 = graph.GetSurface(41, 90);
            var surface22 = graph.GetSurface(22, 50);

            Assert.That(surface1.name == "3");
            Assert.That(surface21.name == "4");
            Assert.That(surface22.name == "5");
            Assert.That(surface41.name == "2");
        }
    void DrawSearchInput()
    {
        EditorGUILayout.BeginVertical(new GUIStyle("box"));

        searchHeight = EditorGUILayout.FloatField("Height", searchHeight);
        searchSlope  = EditorGUILayout.FloatField("Slope", searchSlope);

        if (GUILayout.Button("Search"))
        {
            var surf = biomeSurfaceGraph.GetSurface(searchHeight, searchSlope);

            if (surf == null)
            {
                Debug.Log("Surface not found !");
            }
            else
            {
                Debug.Log("Surface: " + surf.name + ", color: " + surf.color.baseColor);
            }
        }

        EditorGUILayout.EndVertical();
    }