Пример #1
0
 public void UpdateNavMesh()
 {
     foreach (GameObject go in GameObject.FindGameObjectsWithTag("Navable"))
     {
         NavigationBaker navigationBaker = go.GetComponent <NavigationBaker>();
         if (navigationBaker != null)
         {
             navigationBaker.Bake();
             Debug.Log("Telling " + go.name + " to re-bake navmesh");
         }
     }
 }
Пример #2
0
    private void GenerateMap()
    {
        if (UseRandomSeed)
        {
            Seed = DateTime.Now.ToString();
        }

        DateTime start = DateTime.Now;

        RandomFillMap(Seed, FillPercent);
        SmoothMap();
        ProcessMap();

        MeshGenerator meshGenerator = GetComponent <MeshGenerator>();

        meshGenerator.GenerateMesh(map, 1f);

        navMeshBaker = GetComponent <NavigationBaker>();
        navMeshBaker.Bake();

        Debug.Log(string.Format("Map generation total time: {0} ms",
                                (DateTime.Now - start).Milliseconds));
    }