コード例 #1
0
ファイル: Way.cs プロジェクト: Cdrix/SM
    void UpdateBigBoxesPrev()
    {
        InitializeBigBoxPrev();

        float diffYVertic = UMath.ReturnDiffBetwMaxAndMin(_verticPathNew, H.Y);
        float diffYHoriz  = UMath.ReturnDiffBetwMaxAndMin(_horPathNew, H.Y);
        float biggestDiff = UMath.ReturnMax(diffYVertic, diffYHoriz);

        List <float> yS = UList.ReturnAxisList(_verticPathNew, H.Y);

        yS.AddRange(UList.ReturnAxisList(_horPathNew, H.Y));
        float maxY = UMath.ReturnMax(yS);

        if (_dominantSide == H.Vertic)
        {
            var locVertBound = MakeListYVal(BoundsVertic, maxY);
            verticBigBox.UpdatePos(locVertBound, biggestDiff + 0.5f);
            verticBigBox.CheckAndSwitchColor(_isWayOK);
        }
        else if (_dominantSide == H.Horiz)
        {
            var locHorBound = MakeListYVal(BoundsHoriz, maxY);
            horizBigBox.UpdatePos(locHorBound, biggestDiff + 0.5f);
            horizBigBox.CheckAndSwitchColor(_isWayOK);
        }
        //this is for all but bridges and DraggableSquare. Dominant Side here is None
        else if (_dominantSide == H.None && !HType.ToString().Contains("Bridge") && Category != Ca.DraggableSquare)
        {
            UpdateBigBoxesPrevForAllButBridges(maxY, biggestDiff);
        }

        TogglePrevBigBoxesVisible();
    }
コード例 #2
0
ファイル: Registro.cs プロジェクト: Cdrix/SM
    /// <summary>
    /// Taken a list of vectors 3 will find NW, NE, and SW and from there will create a new rectangle
    /// Returns a rectangle in our system where North is on the higher Y value always
    ///
    /// Y val flipped at the end
    /// </summary>
    public static Rect FromALotOfVertexToRect(List <Vector3> list)
    {
        List <float> xS = UList.ReturnAxisList(list, H.X);
        List <float> zS = UList.ReturnAxisList(list, H.Z);

        float minX = UMath.ReturnMinimum(xS);
        float maxX = UMath.ReturnMax(xS);

        float minZ = UMath.ReturnMinimum(zS);
        float maxZ = UMath.ReturnMax(zS);

        //Poly List that only need a valid NW, NE, and SW
        Vector3 NW = new Vector3(minX, 0, maxZ);
        Vector3 NE = new Vector3(maxX, 0, maxZ);
        Vector3 SE = new Vector3(maxX, 0, minZ);
        Vector3 SW = new Vector3(minX, 0, minZ);

        List <Vector3> poly = new List <Vector3>()
        {
            NW, NE, SE, SW
        };

        //here i find the Rect from this poly and then
        // I invert the Y of the recatangle... other wise this big rectangle
        //is not overlapping anything will be far off in the Cordinates...
        //Due to North(up) is bigger here say 100,, and South(down) less say 0 all this on World Z axis
        //As long as MeshManager Hover Current Vertices is big as is its now 9 Lots (each lot 5x5 real polys)
        //the Rect of the buildings will work flawlessly
        return(U2D.ReturnRectYInverted(U2D.FromPolyToRect(poly)));
    }
コード例 #3
0
ファイル: SubPolyr.cs プロジェクト: Cdrix/SM
    //Returns first row list based on the rotation facer
    private List <Vector3> ReturnFirstRow(List <Vector3> listSelected, int rotationFacer)
    {
        List <Vector3> res = new List <Vector3>();

        if (rotationFacer == 0)
        {
            List <float> allZ = UList.ReturnAxisList(listSelected, H.Z);
            float        zMax = UMath.ReturnMax(allZ);
            res = FirstRowLoop(listSelected, zMax, H.Z);
        }
        else if (rotationFacer == 1)
        {
            List <float> allX = UList.ReturnAxisList(listSelected, H.X);
            float        xMax = UMath.ReturnMax(allX);
            res = FirstRowLoop(listSelected, xMax, H.X);
        }
        else if (rotationFacer == 2)
        {
            List <float> allZ = UList.ReturnAxisList(listSelected, H.Z);
            float        zMin = UMath.ReturnMinimum(allZ);
            res = FirstRowLoop(listSelected, zMin, H.Z);
        }
        else if (rotationFacer == 3)
        {
            List <float> allX = UList.ReturnAxisList(listSelected, H.X);
            float        xMin = UMath.ReturnMinimum(allX);
            res = FirstRowLoop(listSelected, xMin, H.X);
        }
        return(res);
    }
コード例 #4
0
ファイル: UPoly.cs プロジェクト: Cdrix/SM
    //will even 1 poly  in Y.
    private List <Vector3> EvenInYPoly(List <Vector3> poly, ref Vector3[] vertices)
    {
        float maxY       = UMath.ReturnMax(poly[0].y, poly[1].y, poly[2].y, poly[3].y);
        float minY       = UMath.ReturnMinimum(poly[0].y, poly[1].y, poly[2].y, poly[3].y);
        float heightDiff = maxY - minY;

        //print(heightDiff + " heightDiff");

        for (int i = 0; i < poly.Count; i++)
        {
            Vector3 newModifiedYPos = poly[i];
            newModifiedYPos.y = minY;
            poly[i]           = newModifiedYPos;
        }

        float epsilon = 0.1f;

        for (int i = 0; i < vertices.Length; i++)
        {
            for (int j = 0; j < poly.Count; j++)
            {
                //if this are the same in X and Z we are updating
                bool x = UMath.nearlyEqual(vertices[i].x, poly[j].x, epsilon);
                bool z = UMath.nearlyEqual(vertices[i].z, poly[j].z, epsilon);
                if (x && z)
                {   //updating the whole vertices matrix
                    vertices[i] = poly[j];
                }
            }
        }
        return(poly);
    }
コード例 #5
0
ファイル: WaterBound.cs プロジェクト: naaturaz/SM
    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
    }
コード例 #6
0
    public static float ReturnMaxFromVector3(Vector3 start, Vector3 end, H axis)
    {
        float max = 0;

        if (axis == H.X)
        {
            max = UMath.ReturnMax(start.x, end.x);
        }
        else if (axis == H.Z)
        {
            max = UMath.ReturnMax(start.z, end.z);
        }
        return(max);
    }
コード例 #7
0
ファイル: UPoly.cs プロジェクト: Cdrix/SM
    //will even many polys in Y. this Method has a bug that
    //put all vertices toghether
    public List <Vector3> EvenInYManyPolys(List <Vector3> manyPoly, ref Vector3[] vertices, ref bool isToEven,
                                           float maxHeightForEven, ref float minY)
    {
        float maxY = UMath.ReturnMax(UList.ReturnAxisList(manyPoly, H.Y));

        minY = UMath.ReturnMinimum(UList.ReturnAxisList(manyPoly, H.Y));
        float heightDiff = maxY - minY;

        if (heightDiff >= maxHeightForEven)
        {
            isToEven = false;
            return(manyPoly);
        }

        isToEven = true;
        //print(heightDiff + " heightDiff");

        for (int i = 0; i < manyPoly.Count; i++)
        {
            Vector3 newModifiedYPos = manyPoly[i];
            newModifiedYPos.y = minY;
            manyPoly[i]       = newModifiedYPos;
        }

        float epsilon = 0.1f;

        for (int i = 0; i < vertices.Length; i++)
        {
            for (int j = 0; j < manyPoly.Count; j++)
            {
                //if this are the same in X and Z we are updating
                bool x = UMath.nearlyEqual(vertices[i].x, manyPoly[j].x, epsilon);
                bool z = UMath.nearlyEqual(vertices[i].z, manyPoly[j].z, epsilon);
                if (x && z)
                {   //updating the whole vertices matrix
                    vertices[i] = manyPoly[j];
                }
            }
        }
        return(manyPoly);
    }
コード例 #8
0
ファイル: QuestManager.cs プロジェクト: naaturaz/SM
    private int GetHighestQuestCompletedOrCurrent()
    {
        var highestC = 0;
        var highestD = 0;

        if (_currentQuests.Count > 0)
        {
            highestC = UMath.ReturnMax(_currentQuests);
        }
        if (_doneQuest.Count > 0)
        {
            highestD = UMath.ReturnMax(_doneQuest);
        }

        List <int> temp = new List <int>()
        {
            highestC, highestD
        };

        return(UMath.ReturnMax(temp));
    }
コード例 #9
0
    private void DefineCurrentRow()
    {
        //_currRow.Add
        var xS = UList.FindXAxisCommonValues(_eaten, H.Descending);
        var zS = UList.FindZAxisCommonValues(_eaten, H.Descending);

        float find = 0;
        H     axis = H.None;

        //norht find the top value on z
        if (_direction == 0)
        {
            find = UMath.ReturnMax(zS);
            axis = H.Z;
        }
        //south
        else if (_direction == 2)
        {
            find = UMath.ReturnMinimum(zS);
            axis = H.Z;
        }
        //east
        else if (_direction == 1)
        {
            find = UMath.ReturnMax(xS);
            axis = H.X;
        }
        //west
        else if (_direction == 3)
        {
            find = UMath.ReturnMinimum(xS);
            axis = H.X;
        }

        _currRow = UList.FindVectorsOnSameRange(_eaten, find, axis, 0.05f);
    }
コード例 #10
0
ファイル: Registro.cs プロジェクト: Cdrix/SM
    /// <summary>
    /// This one use Y as MathCenter
    /// </summary>
    /// <param name="list"></param>
    /// <returns></returns>
    public static List <Vector3> FromALotOfVertexToPolyMathCenterY(List <Vector3> list)
    {
        List <float> xS = UList.ReturnAxisList(list, H.X);
        List <float> zS = UList.ReturnAxisList(list, H.Z);

        float minX = UMath.ReturnMinimum(xS);
        float maxX = UMath.ReturnMax(xS);

        float minZ = UMath.ReturnMinimum(zS);
        float maxZ = UMath.ReturnMax(zS);

        //Poly List that only need a valid NW, NE, and SW
        SMe m = new SMe();
        //throwing rays so we keep the exact Y values
        Vector3 NW = new Vector3(minX, m.IniTerr.MathCenter.y, maxZ);
        Vector3 NE = new Vector3(maxX, m.IniTerr.MathCenter.y, maxZ);
        Vector3 SE = new Vector3(maxX, m.IniTerr.MathCenter.y, minZ);
        Vector3 SW = new Vector3(minX, m.IniTerr.MathCenter.y, minZ);

        return(new List <Vector3>()
        {
            NW, NE, SE, SW
        });
    }