mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
update singleaspect
This commit is contained in:
parent
689932f40b
commit
bea20d57f0
@ -1,3 +1,4 @@
|
||||
using DCFApixels.DragonECS.Core;
|
||||
using DCFApixels.DragonECS.Internal;
|
||||
using DCFApixels.DragonECS.PoolsCore;
|
||||
using System;
|
||||
@ -27,7 +28,7 @@ namespace DCFApixels.DragonECS
|
||||
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.POOLS_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "Pool for IEcsComponent components.")]
|
||||
[MetaID("C501547C9201A4B03FC25632E4FAAFD7")]
|
||||
[DebuggerDisplay("Count: {Count}")]
|
||||
[DebuggerDisplay("{ComponentType}: {Count}")]
|
||||
public sealed class EcsPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack
|
||||
where T : struct, IEcsComponent
|
||||
{
|
||||
@ -218,7 +219,7 @@ namespace DCFApixels.DragonECS
|
||||
_recycledItemsCount = 0; // ñïåðåäè ïîòîìó ÷òîáû îáíóëÿëîñü, òàê êàê Del íå îáíóëÿåò
|
||||
if (_itemsCount <= 0) { return; }
|
||||
_itemsCount = 0;
|
||||
var span = _source.Where(out SingleAspect<EcsPool<T>> _);
|
||||
var span = _source.Where(out SingleAspect<T> _);
|
||||
foreach (var entityID in span)
|
||||
{
|
||||
ref int itemIndex = ref _mapping[entityID];
|
||||
@ -235,6 +236,10 @@ namespace DCFApixels.DragonECS
|
||||
#region Callbacks
|
||||
void IEcsPoolImplementation.OnInit(EcsWorld world, EcsWorld.PoolsMediator mediator, int componentTypeID)
|
||||
{
|
||||
#if DEBUG
|
||||
AllowedInWorldsAttribute.CheckAllows<T>(world);
|
||||
#endif
|
||||
|
||||
_source = world;
|
||||
_mediator = mediator;
|
||||
_componentTypeID = componentTypeID;
|
||||
|
@ -1,3 +1,4 @@
|
||||
using DCFApixels.DragonECS.Core;
|
||||
using DCFApixels.DragonECS.PoolsCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
@ -185,7 +186,7 @@ namespace DCFApixels.DragonECS
|
||||
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
||||
#endif
|
||||
if (_count <= 0) { return; }
|
||||
var span = _source.Where(out SingleAspect<EcsTagPool<T>> _);
|
||||
var span = _source.Where(out SingleTagAspect<T> _);
|
||||
_count = 0;
|
||||
foreach (var entityID in span)
|
||||
{
|
||||
@ -201,6 +202,10 @@ namespace DCFApixels.DragonECS
|
||||
#region Callbacks
|
||||
void IEcsPoolImplementation.OnInit(EcsWorld world, EcsWorld.PoolsMediator mediator, int componentTypeID)
|
||||
{
|
||||
#if DEBUG
|
||||
AllowedInWorldsAttribute.CheckAllows<T>(world);
|
||||
#endif
|
||||
|
||||
_source = world;
|
||||
_mediator = mediator;
|
||||
_componentTypeID = componentTypeID;
|
||||
|
Loading…
Reference in New Issue
Block a user