Exemple #1
0
    /// <summary>
    /// Creates the air and ground parts and addToRegistro
    /// </summary>
    public void CreatePartsRoutine()
    {
        //creates parts above river
        PlanesOnAirPos = ReturnPlanesOnAirPosAndDefinePlanesOnSoil();
        PartsOnAir     = ClassifyABridgeByParts(ReturnPlanesOnAirPosAndDefinePlanesOnSoil().Count);

        createAirPartsNow = true;

        //creates parts on gorund
        //bz has duplicates// the big number is so close tiles dont have a part created
        //only needed if is a road
        if (HType.ToString().Contains("Road"))
        {
            PlanesOnSoil = EliminatesDuplicateDependingOnDominantSide(PlanesOnSoil);
        }
        //if is a trail...
        else if (HType.ToString().Contains("Trail"))
        {
            PlanesOnSoil = UList.EliminateDuplicatesByDist(PlanesOnSoil, 0.01f);
        }

        //bz is not ordered. They need to be ordered to be clasified
        PlanesOnSoil = OrderByXorZ(PlanesOnSoil);
        PartsOnSoil  = ClassifyShorePoints();

        //must be called here... So still we are using the CurrentSpawnBuild obj
        AddBridgeToRegistro();
    }
Exemple #2
0
    private void DefineMountPath(List <float> yS)
    {
        float highest = UMath.ReturnMax(yS);

        _mountainPath = UList.FindVectorsOnSameHeight(m.AllVertexs, highest, 0.03f); //0.03f
        _mountainPath = UList.EliminateDuplicatesByDist(_mountainPath, 0.4f);        //0.2
    }
Exemple #3
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();
    }
Exemple #4
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();
    }
Exemple #5
0
 /// <summary>
 /// This eliminates duplicates of the bridge parts vectors3. Some pos are to close
 /// based on dominant side this will elimitaes the duplicates taht are less than 5 times the subdive x or z - 0.01f
 /// </summary>
 private List <Vector3> EliminatesDuplicateDependingOnDominantSide(List <Vector3> list)
 {
     if (_dominantSide == H.Vertic)
     {
         return(UList.EliminateDuplicatesByDist(list, (Mathf.Abs(m.SubDivide.ZSubStep) * 5) - 0.01f));
     }
     if (_dominantSide == H.Horiz)
     {
         return(UList.EliminateDuplicatesByDist(list, (Mathf.Abs(m.SubDivide.XSubStep) * 5) - 0.01f));
     }
     return(null);
 }