コード例 #1
0
ファイル: Tilemap.cs プロジェクト: 12ooster/rpg-project
        /// <summary>
        /// Force an update of all tilechunks. This is called after changing sensitive data like CellSize, Collider depth, etc
        /// </summary>
        /// <param name="refreshMesh"></param>
        /// <param name="refreshMeshCollider"></param>
        public void Refresh(bool refreshMesh = true, bool refreshMeshCollider = true, bool refreshTileObjects = false, bool invalidateBrushes = false)
        {
            BuildTilechunkDictionary();
            var valueIter = m_dicChunkCache.Values.GetEnumerator();

            while (valueIter.MoveNext())
            {
                TilemapChunk chunk = valueIter.Current;
                if (chunk)
                {
                    if (refreshMesh)
                    {
                        chunk.InvalidateMesh();
                    }
                    if (refreshMeshCollider)
                    {
                        chunk.InvalidateMeshCollider();
                    }
                    if (refreshTileObjects)
                    {
                        chunk.RefreshTileObjects();
                    }
                    if (invalidateBrushes)
                    {
                        chunk.InvalidateBrushes();
                    }
                }
            }
            UpdateMesh();
        }
コード例 #2
0
 /// <summary>
 /// Force an update of all tilechunks. This is called after changing sensitive data like CellSize, Collider depth, etc
 /// </summary>
 /// <param name="refreshMesh"></param>
 /// <param name="refreshMeshCollider"></param>
 public void Refresh(bool refreshMesh = true, bool refreshMeshCollider = true, bool refreshTileObjects = false, bool invalidateBrushes = false)
 {
     for (int i = 0; i < transform.childCount; ++i)
     {
         TilemapChunk chunk = transform.GetChild(i).GetComponent <TilemapChunk>();
         if (chunk != null)
         {
             if (refreshMesh)
             {
                 chunk.InvalidateMesh();
             }
             if (refreshMeshCollider)
             {
                 chunk.InvalidateMeshCollider();
             }
             if (refreshTileObjects)
             {
                 chunk.RefreshTileObjects();
             }
             if (invalidateBrushes)
             {
                 chunk.InvalidateBrushes();
             }
         }
     }
     UpdateMesh();
 }