예제 #1
0
            public void RemoveEntitiesFromGroup(ExclusiveBuildGroup groupID, [CallerMemberName] string caller = null)
            {
                DBC.ECS.Check.Require(groupID.isInvalid == false, "invalid group detected");
                _enginesRoot.Target.RemoveGroupID(groupID);

                _enginesRoot.Target.QueueRemoveGroupOperation(groupID, caller);
            }
예제 #2
0
        public void SwapEntity(EGID from, ExclusiveBuildGroup to, int threadIndex)
        {
            var simpleNativeBag = _swapQueue.GetBuffer(threadIndex);

            simpleNativeBag.Enqueue(_indexSwap);
            simpleNativeBag.Enqueue(new DoubleEGID(from, new EGID(from.entityID, to)));
        }
예제 #3
0
 public EntityInitializer BuildEntity <T>
     (uint entityID, ExclusiveBuildGroup groupStructId, T descriptorEntity, IEnumerable <object> implementors)
     where T : IEntityDescriptor
 {
     return(_enginesRoot.Target.BuildEntity(new EGID(entityID, groupStructId)
                                            , descriptorEntity.componentsToBuild, TypeCache <T> .type, implementors));
 }
예제 #4
0
 public EntityInitializer BuildEntity <T>
     (uint entityID, ExclusiveBuildGroup groupStructId, IEnumerable <object> implementors = null
     , [CallerMemberName] string caller = null) where T : IEntityDescriptor, new()
 {
     return(_enginesRoot.Target.BuildEntity(new EGID(entityID, groupStructId)
                                            , EntityDescriptorTemplate <T> .descriptor.componentsToBuild
                                            , TypeCache <T> .type, implementors, caller));
 }
            public void RemoveEntitiesFromGroup(ExclusiveBuildGroup groupID)
            {
                DBC.ECS.Check.Require(groupID != 0, "invalid group detected");
                _enginesRoot.Target.RemoveGroupID(groupID);

                _enginesRoot.Target.QueueEntitySubmitOperation(
                    new EntitySubmitOperation(EntitySubmitOperationType.RemoveGroup, new EGID(0, groupID), new EGID()));
            }
            public void SwapEntityGroup <T>(EGID fromID, EGID toID, ExclusiveBuildGroup mustBeFromGroup)
                where T : IEntityDescriptor, new()
            {
                if (fromID.groupID != mustBeFromGroup)
                {
                    throw new ECSException($"Entity is not coming from the expected group Expected {mustBeFromGroup} is {fromID.groupID}");
                }

                SwapEntityGroup <T>(fromID, toID);
            }
예제 #7
0
        public NativeEntityInitializer BuildEntity
            (uint eindex, ExclusiveBuildGroup exclusiveBuildGroup, int threadIndex)
        {
            NativeBag unsafeBuffer = _addOperationQueue.GetBuffer(threadIndex + 1);

            unsafeBuffer.Enqueue(_index);
            unsafeBuffer.Enqueue(new EGID(eindex, exclusiveBuildGroup));
            unsafeBuffer.ReserveEnqueue <uint>(out var index) = 0;

            return(new NativeEntityInitializer(unsafeBuffer, index));
        }
예제 #8
0
            public void SwapEntityGroup <T>
                (EGID fromEGID, EGID toEGID, ExclusiveBuildGroup mustBeFromGroup, [CallerMemberName] string caller = null)
                where T : IEntityDescriptor, new()
            {
                if (fromEGID.groupID != mustBeFromGroup)
                {
                    throw new ECSException(
                              $"Entity is not coming from the expected group Expected {mustBeFromGroup} is {fromEGID.groupID}");
                }

                SwapEntityGroup <T>(fromEGID, toEGID, caller);
            }
예제 #9
0
            public void SwapEntitiesInGroup
                (ExclusiveBuildGroup fromGroupID, ExclusiveBuildGroup toGroupID, [CallerMemberName] string caller = null)
            {
                if (_enginesRoot.Target._groupEntityComponentsDB.TryGetValue(
                        fromGroupID.group
                        , out FasterDictionary <RefWrapperType, ITypeSafeDictionary> entitiesInGroupPerType) == true)
                {
#if DEBUG && !PROFILE_SVELTO
                    ITypeSafeDictionary dictionary = entitiesInGroupPerType.unsafeValues[0];

                    dictionary.KeysEvaluator((key) =>
                    {
                        _enginesRoot.Target.CheckRemoveEntityID(new EGID(key, fromGroupID), null, caller);
                        _enginesRoot.Target.CheckAddEntityID(new EGID(key, toGroupID), null, caller);
                    });
#endif
                    _enginesRoot.Target.QueueSwapGroupOperation(fromGroupID, toGroupID, caller);
                }
            }
            public void SwapEntitiesInGroup <T>(ExclusiveBuildGroup fromGroupID, ExclusiveBuildGroup toGroupID)
                where T : IEntityDescriptor, new()
            {
                if (_enginesRoot.Target._groupEntityComponentsDB.TryGetValue(
                        fromGroupID.group, out FasterDictionary <RefWrapperType, ITypeSafeDictionary> entitiesInGroupPerType)
                    == true)
                {
#if DEBUG && !PROFILE_SVELTO
                    IComponentBuilder[] components = EntityDescriptorTemplate <T> .descriptor.componentsToBuild;
                    var dictionary = entitiesInGroupPerType[new RefWrapperType(components[0].GetEntityComponentType())];

                    dictionary.KeysEvaluator((key) =>
                    {
                        _enginesRoot.Target.CheckRemoveEntityID(new EGID(key, fromGroupID), TypeCache <T> .type);
                        _enginesRoot.Target.CheckAddEntityID(new EGID(key, toGroupID), TypeCache <T> .type);
                    });
#endif
                    _enginesRoot.Target.QueueEntitySubmitOperation(
                        new EntitySubmitOperation(EntitySubmitOperationType.SwapGroup, new EGID(0, fromGroupID)
                                                  , new EGID(0, toGroupID)));
                }
            }
 public void RemoveEntity <T>(uint entityID, ExclusiveBuildGroup groupID) where T :
 IEntityDescriptor, new()
 {
     RemoveEntity <T>(new EGID(entityID, groupID));
 }
예제 #12
0
 public void RemoveEntity <T>
     (uint entityID, ExclusiveBuildGroup groupID, [CallerMemberName] string caller = null)
     where T : IEntityDescriptor, new()
 {
     RemoveEntity <T>(new EGID(entityID, groupID), caller);
 }
 public void SwapEntityGroup <T>(EGID fromID, ExclusiveBuildGroup toGroupID)
     where T : IEntityDescriptor, new()
 {
     SwapEntityGroup <T>(fromID, new EGID(fromID.entityID, (uint)toGroupID));
 }
예제 #14
0
 public void SwapEntityGroup <T>
     (uint entityID, ExclusiveBuildGroup fromGroupID, ExclusiveBuildGroup toGroupID
     , [CallerMemberName] string caller = null) where T : IEntityDescriptor, new()
 {
     SwapEntityGroup <T>(new EGID(entityID, fromGroupID), toGroupID, caller);
 }
예제 #15
0
 public void SwapEntityGroup <T>
     (EGID fromEGID, ExclusiveBuildGroup toGroupID, [CallerMemberName] string caller = null)
     where T : IEntityDescriptor, new()
 {
     SwapEntityGroup <T>(fromEGID, new EGID(fromEGID.entityID, toGroupID), caller);
 }
예제 #16
0
 public void AddSwapGroupOperation(ExclusiveBuildGroup fromGroupID, ExclusiveBuildGroup toGroupID, string caller)
 {
     _thisSubmissionInfo._groupsToSwap.Add((fromGroupID, toGroupID, caller));
 }
예제 #17
0
 void QueueSwapGroupOperation(ExclusiveBuildGroup fromGroupID, ExclusiveBuildGroup toGroupID, string caller)
 {
     _entitiesOperations.AddSwapGroupOperation(fromGroupID, toGroupID, caller);
 }
 public void SwapEntityGroup <T>(uint entityID, ExclusiveBuildGroup fromGroupID,
                                 ExclusiveBuildGroup toGroupID)
     where T : IEntityDescriptor, new()
 {
     SwapEntityGroup <T>(new EGID(entityID, fromGroupID), toGroupID);
 }
예제 #19
0
 public EGID(uint entityID, ExclusiveBuildGroup groupID) : this()
 {
     _GID = MAKE_GLOBAL_ID(entityID, groupID.group);
 }
예제 #20
0
 public void AddRemoveGroupOperation(ExclusiveBuildGroup groupID, string caller)
 {
     _thisSubmissionInfo._groupsToRemove.Add((groupID, caller));
 }
예제 #21
0
 void RemoveGroupID(ExclusiveBuildGroup groupID)
 {
     _idChecker.Remove(groupID);
 }
예제 #22
0
 void QueueRemoveGroupOperation(ExclusiveBuildGroup groupID, string caller)
 {
     _entitiesOperations.AddRemoveGroupOperation(groupID, caller);
 }