Exemplo n.º 1
0
    /// <summary>
    /// This are the vertices that create the marine bound
    /// </summary>
    private void FindVertexUnderNeathWater()
    {
        var   yS         = UList.FindYAxisCommonValues(m.AllVertexs, H.Descending);
        float firstUnder = UList.FindFirstYBelow(yS, Program.gameScene.WaterBody.transform.position.y);

        _marineBounds = UList.FindVectorsOnSameHeight(m.AllVertexs, firstUnder, 0.05f); //0.07f
        _marineBounds = UList.EliminateDuplicatesByDist(_marineBounds, 0.3f);           //0.2

        float firstClos = UList.FindFirstYBelow(yS, m.IniTerr.MathCenter.y - 1f);
        var   closer    = UList.FindVectorsOnSameHeight(m.AllVertexs, firstClos, 0.02f); //0.07f

        closer = UList.EliminateDuplicatesByDist(closer, 0.3f);                          //0.2

        _marineBounds.AddRange(closer);

        float lowest = UMath.ReturnMinimumDifferentThanZero(yS) + 1f;
        var   low    = UList.FindVectorsOnSameHeight(m.AllVertexs, lowest, 0.01f); //0.07f

        low = UList.EliminateDuplicatesByDist(low, 0.4f);                          //0.2

        _marineBounds.AddRange(low);

        //RenderMarineBounds();
        Debug.Log(_marineBounds.Count + " _marineBounds");
        //AddMarinePositions();

        DefineSeaPath(_marineBounds);
        addMarine = true;

        //AddMarineBoundsToCrystal();
    }
Exemplo n.º 2
0
    public void FindVertexAboveTerrainLevel()
    {
        var   yS         = UList.FindYAxisCommonValues(m.AllVertexs, H.Ascending);
        float firstAbove = UList.FindFirstYAbove(yS, m.IniTerr.MathCenter.y + 2f);

        _mountainBounds = UList.FindVectorsOnSameHeight(m.AllVertexs, firstAbove, 0.07f);//0.07f
        _mountainBounds = UList.EliminateDuplicatesByDist(_mountainBounds, 1f);

        //a layer 2 toward the top
        float lay2   = UList.FindFirstYAbove(yS, m.IniTerr.MathCenter.y + 3f);
        var   layer2 = UList.FindVectorsOnSameHeight(m.AllVertexs, lay2, 0.07f);//0.07f

        layer2 = UList.EliminateDuplicatesByDist(layer2, 1f);
        _mountainBounds.AddRange(layer2);

        //a layer 3 toward the top
        float lay3   = UList.FindFirstYAbove(yS, m.IniTerr.MathCenter.y + 4f);
        var   layer3 = UList.FindVectorsOnSameHeight(m.AllVertexs, lay3, 0.07f);//0.07f

        layer3 = UList.EliminateDuplicatesByDist(layer3, 1f);
        _mountainBounds.AddRange(layer3);

        DefineMountPath(yS);

        _mountainBounds.AddRange(_mountainPath);
        Debug.Log("_mountainBounds count: " + _mountainPath.Count);

        //bz was used by marine b4

        Save();

        addMount = true;

        //RenderMountainBounds();
    }
Exemplo n.º 3
0
    private float valYSearch = 0.0001f;//0.05f

    private void PullMostCommonYLayer()
    {
        var   yS      = UList.FindYAxisCommonValues(m.AllVertexs, H.Descending);
        float yCommon = UList.FindFirstYBelow(yS, m.IniTerr.MathCenter.y);

        _commomLayer = UList.FindVectorsOnSameHeight(m.Vertices.ToList(), yCommon, valYSearch);

        Debug.Log("_commomLayer.Count:" + _commomLayer.Count);

        if (_commomLayer.Count == 0 && secCount < 1000)
        {
            valYSearch += 0.001f;
            secCount++;
            PullMostCommonYLayer();
        }
        else if (_commomLayer.Count == 0 && secCount >= 1000)
        {
            throw new Exception("Not pull anything from CommonY Layer");
        }
    }