Пример #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();
    }