コード例 #1
0
        public void Playback()
        {
            DebugHelper.AssertThrow <ThreadAccessException>(ECSWorld.CheckThreadIsMainThread());
            if (!IsEmpty())
            {
                Jobs.CompleteAllJobs();
                int i = 0;
                while (i < modList.Length)
                {
                    IModification?mod = modList[i++];
                    if (mod == null)
                    {
                        break;
                    }

                    try {
                        mod.Execute(this);
                    }
                    catch (InvalidEntityException _) { }
                    catch (ComponentNotFoundException _) { }
                }

                pool.Return(modList);
                modList         = Array.Empty <IModification?>();
                entityTarget    = default;
                hasEntityTarget = false;
                nextIndex       = 0;
            }
        }
コード例 #2
0
 public bool TryGetComponentData <T>(out Span <T> data) where T : unmanaged, IComponent
 {
     DebugHelper.AssertThrow <ThreadAccessException>(ECSWorld.CheckThreadIsMainThread());
     Jobs.CompleteAllJobs();
     if (block.archetype.Has <T>())
     {
         block.IncrementComponentVersion(TypeHelper <T> .hashCode);
         data = block.GetComponentData <T>().Slice(0, block.Size);
         return(true);
     }
     else
     {
         data = Span <T> .Empty;
         return(false);
     }
 }
コード例 #3
0
        public bool IsEmpty()
        {
            DebugHelper.AssertThrow <ThreadAccessException>(ECSWorld.CheckThreadIsMainThread());
            Jobs.CompleteAllJobs();
            if (threadBuffersCache == null)
            {
                threadBuffersCache = threadBuffers.Values as List <EntityCommandBuffer>;
            }
            foreach (EntityCommandBuffer buffer in threadBuffersCache)
            {
                if (!buffer.IsEmpty())
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
 public void SyncPoint()
 {
     Profiler.StartMethod("Sync");
     Jobs.CompleteAllJobs();
     Profiler.EndMethod();
 }