Exemple #1
0
    private void Start()
    {
        // To "Bake" the node map to capture untraversable areas. Whill scan the each node on wallTileMap for untraversable tiles on nodeMap
        nodeMap.BakeBlockedMap(wallTileMap);

        // Baking traversable but not desirable areas with 1.5 cost
        nodeMap.BakeCostMap(LayerMask.GetMask("Water"), 1.5f);

        /*
         * For 3D map baking
         *
         * Overloaded method, takes integer repersenting LayerMask id for *IGNORED* physics layer
         *
         * Scans each node with Physics.CheckSphere() for colliders around node, any collider detected not in above mentioned LayerMask will be consider an obstacle.
         * Therefore, marking that node as untraversable.
         */

        // nodeMap.BakeBlockedMap(LayerMask.GetMask("Ignore Raycast"));


        // Save baked map as "MyNodeMap.bin" at ../UnityProjectFile/Assets/MyNodeMap.bin
        nodeMap.Save("MyNodeMap");

        // Load baked map from ../UnityProjectFile/Assets/MyNodeMap.bin
        nodeMap = NodeMap.Load("MyNodeMap");
    }