コード例 #1
0
        void computeTriangleIndices(int totalTris = 20)
        {
            _indices.reset();

            // compute the indices to form triangles
            for (var i = 0; i < totalTris; i += 2)
            {
                _indices.add(0);
                _indices.add((short)(i + 2));
                _indices.add((short)(i + 1));
            }
        }
コード例 #2
0
        void generateVertsFromEncounters(List <Vector2> encounters)
        {
            _vertices.reset();

            // add a vertex for the center of the mesh
            addVert(entity.transform.position);

            // add all the other encounter points as vertices storing their world position as UV coordinates
            for (var i = 0; i < encounters.Count; i++)
            {
                addVert(encounters[i]);
            }

            // if we dont have enough tri indices add enough for our encounter list
            var triIndices = _indices.length / 3;

            if (encounters.Count > triIndices)
            {
                computeTriangleIndices(encounters.Count);
            }
        }