Exemplo n.º 1
0
    public void _DEBUG_VISUAL_boxAStarNodes()
    {
        Vector3[]  points;
        Vector3[]  norms = new Vector3[] { Vector3.up, Vector3.up, Vector3.up, Vector3.up, Vector3.up };
        GameObject go;

        float highest = Mathf.Max(nodeDimensions);
        float lowest  = Mathf.Min(nodeDimensions);

        for (int k = 0; k < theAStarGrid.nodes.Count; k++)
        {
            int x = (theAStarGrid.nodes [k].getXCorner());
            int y = (theAStarGrid.nodes [k].getYCorner());
            int h = (theAStarGrid.nodes [k].getHeight());
            int w = (theAStarGrid.nodes [k].getWidth());

            float val = (((float)w - lowest) / (highest - lowest));

            go = Instantiate(MESHGEN_STAPLE) as GameObject;
            Vector3 pt1 = new Vector3(x, theCCDynamicFieldManager.theMapData.getHeightMap(x, y), y);
            Vector3 pt2 = new Vector3(x + w + 1, theCCDynamicFieldManager.theMapData.getHeightMap(x + w, y), y);
            Vector3 pt3 = new Vector3(x + w + 1, theCCDynamicFieldManager.theMapData.getHeightMap(x + w, y + h), y + h + 1);
            Vector3 pt4 = new Vector3(x, theCCDynamicFieldManager.theMapData.getHeightMap(x, y + h), y + h + 1);
            Vector3 pt5 = new Vector3(x, theCCDynamicFieldManager.theMapData.getHeightMap(x, y), y);

            points = new Vector3[] { pt1, pt2, pt3, pt4, pt5 };

            meshLineGenerator m = go.GetComponent <meshLineGenerator> ();

            m.setLinePoints(points, norms);
            m.generateMesh();
            m.setColor(rainbow(val));
        }
    }
Exemplo n.º 2
0
    void filterAndSubmitLine()
    {
        // adding filtering operations

        theLineGenerator.setLinePoints(linePoints.ToArray(), linePointNormals.ToArray());
        theLineGenerator.generateMesh();
    }