Exemplo n.º 1
0
        public Region(Vector2 site, Vertex[] vertices)
        {
            type = new RegionType(this);

            this.site     = new Site(this, site);
            this.vertices = vertices;

            UpdateVertices();

            bounds = MathVert.GetBoundsBetween(EdgePositions());
            ranges = MathVert.GetRangesBetween(bounds);
        }
Exemplo n.º 2
0
        private void SetMapHeight()
        {
            foreach (Triangle triangle in Triangle.allTriangles)
            {
                if (triangle.GetMidCLIndex() <= 0)
                {
                    continue;
                }

                //Drawer.DrawConnectedLines(triangle.GetSitePositions(), Color.white);

                Vector3[] trianglePoints = new Vector3[3];
                for (int i = 0; i < 3; i++)
                {
                    trianglePoints[i] = SiteWithHeight(triangle.sites[i].parent);
                }

                Vector2Int[] bounds = MathVert.GetBoundsBetween(triangle.GetSitePositions());
                for (int i = 0; i < bounds.Length - 1; i++)
                {
                    Vector2Int quadPos     = WorldMesh.VertexPosToQuadPos(bounds[i], bounds[i + 1]);
                    int        oriantation = WorldMesh.GetOriantation(bounds[i], bounds[i + 1]);
                    // WorldMesh.oriantationMap[quadPos.x, quadPos.y] = oriantation;
                }

                Vector2Int[] positions = MathVert.GetPositionsBetween(MathVert.GetRangesBetween(bounds));
                foreach (Vector2Int position in positions)
                {
                    //Drawer.DrawHLine(position, Color.white);
                    //WorldMesh.colorMap[position.x, position.y].ALL = Color.red;
                    Vector3 vertex = WorldMesh.verticesMap[position.x, position.y];
                    vertex.y = MathVert.GetHeihtBetween3Points(position, trianglePoints);
                    WorldMesh.verticesMap[position.x, position.y] = vertex;
                }
            }
        }