private void configAI()
    {
        BoundsInt bounds = floorMap.cellBounds;
        int       width  = bounds.xMax - bounds.xMin + 2;
        int       depth  = bounds.yMax - bounds.yMin + 2;
        Vector3   center = bounds.center;

        center.z = 0;

        AstarData data = AstarPath.active.data;

        GridGraph gg = data.FindGraphOfType(typeof(GridGraph)) as GridGraph;

        float nodeSize = 1;

        gg.center = center;

        gg.SetDimensions(width, depth, nodeSize);

        Invoke("Scan", 0.5f);
    }
示例#2
0
    public void Click()
    {
        GameObject DepthTerrain = GameObject.Find("DepthView");

        DepthTerrain.GetComponent <DepthSourceView> ().updateTerrain = false;



        GameObject.Find("_SandBoxData").GetComponent <SandBoxData> ().ARS_Data.mesh = DepthTerrain.GetComponent <MeshFilter> ().mesh;

        AstarPath aSP = GetComponent <AstarPath> ();

        AstarData aSD = aSP.astarData;

        GridGraph gg = aSD.FindGraphOfType(typeof(GridGraph)) as GridGraph;

        if (gg != null)
        {
            Debug.Log(gg.collision.fromHeight);
            Debug.Log(gg.name);
        }

        AstarPath.active.Scan();
    }