Exemple #1
0
    // Token: 0x06000B51 RID: 2897 RVA: 0x00051A08 File Offset: 0x0004FC08
    private void RebuildLinks(Pathfinding.NavMeshTile tile)
    {
        Pathfinding.AgentType     z        = (Pathfinding.AgentType)tile.m_tile.z;
        Pathfinding.AgentSettings settings = this.GetSettings(z);
        float num = this.m_tileSize / 2f;

        this.ConnectAlongEdge(tile.m_links1, tile.m_center + new Vector3(num, 0f, num), tile.m_center + new Vector3(num, 0f, -num), this.m_linkWidth, settings);
        this.ConnectAlongEdge(tile.m_links2, tile.m_center + new Vector3(-num, 0f, num), tile.m_center + new Vector3(num, 0f, num), this.m_linkWidth, settings);
    }
Exemple #2
0
    // Token: 0x06000B4C RID: 2892 RVA: 0x000516E0 File Offset: 0x0004F8E0
    private void BuildTile(Pathfinding.NavMeshTile tile)
    {
        DateTime now = DateTime.Now;
        List <NavMeshBuildSource> list    = new List <NavMeshBuildSource>();
        List <NavMeshBuildMarkup> markups = new List <NavMeshBuildMarkup>();

        Pathfinding.AgentType     z        = (Pathfinding.AgentType)tile.m_tile.z;
        Pathfinding.AgentSettings settings = this.GetSettings(z);
        Bounds includedWorldBounds         = new Bounds(tile.m_center, new Vector3(this.m_tileSize, 6000f, this.m_tileSize));
        Bounds localBounds = new Bounds(Vector3.zero, new Vector3(this.m_tileSize, 6000f, this.m_tileSize));
        int    defaultArea = settings.m_canWalk ? 0 : 1;

        NavMeshBuilder.CollectSources(includedWorldBounds, this.m_layers.value, NavMeshCollectGeometry.PhysicsColliders, defaultArea, markups, list);
        if (settings.m_avoidWater)
        {
            List <NavMeshBuildSource> list2 = new List <NavMeshBuildSource>();
            NavMeshBuilder.CollectSources(includedWorldBounds, this.m_waterLayers.value, NavMeshCollectGeometry.PhysicsColliders, 1, markups, list2);
            using (List <NavMeshBuildSource> .Enumerator enumerator = list2.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    NavMeshBuildSource item = enumerator.Current;
                    item.transform *= Matrix4x4.Translate(Vector3.down * 0.2f);
                    list.Add(item);
                }
                goto IL_1AE;
            }
        }
        if (settings.m_canSwim)
        {
            List <NavMeshBuildSource> list3 = new List <NavMeshBuildSource>();
            NavMeshBuilder.CollectSources(includedWorldBounds, this.m_waterLayers.value, NavMeshCollectGeometry.PhysicsColliders, 3, markups, list3);
            if (settings.m_swimDepth != 0f)
            {
                using (List <NavMeshBuildSource> .Enumerator enumerator = list3.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        NavMeshBuildSource item2 = enumerator.Current;
                        item2.transform *= Matrix4x4.Translate(Vector3.down * settings.m_swimDepth);
                        list.Add(item2);
                    }
                    goto IL_1AE;
                }
            }
            list.AddRange(list3);
        }
IL_1AE:
        if (tile.m_data == null)
        {
            tile.m_data          = new NavMeshData();
            tile.m_data.position = tile.m_center;
        }
        this.m_buildOperation = NavMeshBuilder.UpdateNavMeshDataAsync(tile.m_data, settings.m_build, list, localBounds);
        this.m_buildTile      = tile;
    }
Exemple #3
0
 // Token: 0x06000B57 RID: 2903 RVA: 0x00051E38 File Offset: 0x00050038
 private Pathfinding.NavMeshTile GetNavTile(Vector3Int tile)
 {
     if (tile == this.m_cachedTileID)
     {
         return(this.m_cachedTile);
     }
     Pathfinding.NavMeshTile navMeshTile;
     if (this.m_tiles.TryGetValue(tile, out navMeshTile))
     {
         this.m_cachedTileID = tile;
         this.m_cachedTile   = navMeshTile;
         return(navMeshTile);
     }
     navMeshTile          = new Pathfinding.NavMeshTile();
     navMeshTile.m_tile   = tile;
     navMeshTile.m_center = this.GetTilePos(tile);
     this.m_tiles.Add(tile, navMeshTile);
     this.m_cachedTileID = tile;
     this.m_cachedTile   = navMeshTile;
     return(navMeshTile);
 }
Exemple #4
0
    // Token: 0x06000B4B RID: 2891 RVA: 0x00051640 File Offset: 0x0004F840
    private void Buildtiles()
    {
        if (this.UpdateAsyncBuild())
        {
            return;
        }
        Pathfinding.NavMeshTile navMeshTile = null;
        float num = 0f;

        foreach (Pathfinding.NavMeshTile navMeshTile2 in this.m_tiles.Values)
        {
            float num2 = navMeshTile2.m_pokeTime - navMeshTile2.m_buildTime;
            if (num2 > this.m_updateInterval && (navMeshTile == null || num2 > num))
            {
                navMeshTile = navMeshTile2;
                num         = num2;
            }
        }
        if (navMeshTile != null)
        {
            this.BuildTile(navMeshTile);
            navMeshTile.m_buildTime = Time.realtimeSinceStartup;
        }
    }
Exemple #5
0
 // Token: 0x06000B4F RID: 2895 RVA: 0x0005198E File Offset: 0x0004FB8E
 private void ClearLinks(Pathfinding.NavMeshTile tile)
 {
     this.ClearLinks(tile.m_links1);
     this.ClearLinks(tile.m_links2);
 }