Exemple #1
0
 private void CopyState <T>(ref NativeEntityArray <T> ary, ref NativeArray <T> entityAry) where T : unmanaged, IEntity
 {
     if (ary.Length != 0)
     {
         if (entityAry.Length == ary._EntityAry.Length)
         {
             NativeArray <T> .Copy(ary._EntityAry, entityAry);
         }
         else
         {
             if (entityAry.Length != 0)
             {
                 entityAry.Dispose();
             }
             entityAry = new NativeArray <T>(ary._EntityAry, Allocator.Persistent);
         }
     }
     else
     {
         if (entityAry.Length != 0)
         {
             entityAry.Dispose();
         }
     }
 }
 private void CopyState <T>(ref NativeEntityArray <T> ary, ref NativeArray <T> _allBoids) where T : unmanaged, IEntity
 {
     if (ary.Length != 0)
     {
         if (_allBoids.Length == ary._EntityAry.Length)
         {
             NativeArray <T> .Copy(ary._EntityAry, _allBoids);
         }
         else
         {
             if (_allBoids.Length != 0)
             {
                 _allBoids.Dispose();
             }
             _allBoids = new NativeArray <T>(ary._EntityAry, Allocator.Persistent);
         }
     }
     else
     {
         if (_allBoids.Length != 0)
         {
             _allBoids.Dispose();
         }
     }
 }