mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-19 10:34:37 +08:00
remove usless
This commit is contained in:
parent
9e865ffdbe
commit
53b7fae2c4
@ -1,62 +0,0 @@
|
|||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
|
||||||
{
|
|
||||||
public class EcsFilter
|
|
||||||
{
|
|
||||||
private readonly IEcsWorld _source;
|
|
||||||
internal readonly EcsGroup entities;
|
|
||||||
private readonly EcsMask _mask;
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public IEcsWorld World
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => _source;
|
|
||||||
}
|
|
||||||
public EcsMask Mask
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => _mask;
|
|
||||||
}
|
|
||||||
public EcsReadonlyGroup Entities
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => entities.Readonly;
|
|
||||||
}
|
|
||||||
public int EntitiesCount
|
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => entities.Count;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constrcutors
|
|
||||||
internal EcsFilter(IEcsWorld source, EcsMask mask, int capasity)
|
|
||||||
{
|
|
||||||
_source = source;
|
|
||||||
_mask = mask;
|
|
||||||
entities = new EcsGroup(source, capasity);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region EntityChangedReact
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
internal void Add(int entityID)
|
|
||||||
{
|
|
||||||
entities.UncheckedAdd(entityID);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
internal void Remove(int entityID)
|
|
||||||
{
|
|
||||||
entities.UncheckedRemove(entityID);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region GetEnumerator
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public EcsGroup.Enumerator GetEnumerator() => entities.GetEnumerator();
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using delayedOp = System.Int32;
|
using delayedOp = System.Int32;
|
||||||
@ -184,11 +183,6 @@ namespace DCFApixels.DragonECS
|
|||||||
Array.Resize(ref _sparse, newSize);
|
Array.Resize(ref _sparse, newSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO добавить метод Sort
|
|
||||||
|
|
||||||
//TODO добавить автосоритровку при каждом GetEnumerator и проверить будет ли прирост производительности или ее падение.
|
|
||||||
//Суть в том что так возможно можно будет более плотно подавать данные в проц
|
|
||||||
|
|
||||||
public void Sort()
|
public void Sort()
|
||||||
{
|
{
|
||||||
int increment = 1;
|
int increment = 1;
|
||||||
@ -202,7 +196,6 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region AddGroup/RemoveGroup
|
#region AddGroup/RemoveGroup
|
||||||
public void AddGroup(EcsReadonlyGroup group)
|
public void AddGroup(EcsReadonlyGroup group)
|
||||||
{ foreach (var item in group) Add(item.id); }
|
{ foreach (var item in group) Add(item.id); }
|
||||||
@ -248,7 +241,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public Enumerator GetEnumerator()
|
public Enumerator GetEnumerator()
|
||||||
{
|
{
|
||||||
// Sort();
|
Sort();
|
||||||
_lockCount++;
|
_lockCount++;
|
||||||
return new Enumerator(this);
|
return new Enumerator(this);
|
||||||
}
|
}
|
||||||
@ -283,10 +276,10 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Dispose() => _source.Unlock();
|
public void Dispose()
|
||||||
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
_source.Unlock();
|
||||||
public void Reset() { }
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,6 @@ namespace DCFApixels.DragonECS
|
|||||||
private short[] _gens; //старший бит указывает на то жива ли сущьность.
|
private short[] _gens; //старший бит указывает на то жива ли сущьность.
|
||||||
|
|
||||||
//private short[] _componentCounts; //TODO
|
//private short[] _componentCounts; //TODO
|
||||||
|
|
||||||
private IEcsPool[] _pools;
|
private IEcsPool[] _pools;
|
||||||
private EcsNullPool _nullPool;
|
private EcsNullPool _nullPool;
|
||||||
|
|
||||||
@ -154,10 +153,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
return (EcsPool<T>)_pools[uniqueID];
|
return (EcsPool<T>)_pools[uniqueID];
|
||||||
}
|
}
|
||||||
public EcsPool<T> UncheckedGetPool<T>() where T : struct
|
//public EcsPool<T> UncheckedGetPool<T>() where T : struct => (EcsPool<T>)_pools[ComponentType<T>.uniqueID];
|
||||||
{
|
|
||||||
return (EcsPool<T>)_pools[ComponentType<T>.uniqueID];
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Entities
|
#region Entities
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
@ -11,6 +7,8 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Properties
|
#region Properties
|
||||||
/// <summary>Table Archetype</summary>
|
/// <summary>Table Archetype</summary>
|
||||||
public Type ArchetypeType { get; }
|
public Type ArchetypeType { get; }
|
||||||
|
internal int Count { get; }
|
||||||
|
internal int Capacity { get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
@ -18,7 +16,6 @@ namespace DCFApixels.DragonECS
|
|||||||
public int GetComponentID<T>();
|
public int GetComponentID<T>();
|
||||||
|
|
||||||
public EcsPool<T> GetPool<T>() where T : struct;
|
public EcsPool<T> GetPool<T>() where T : struct;
|
||||||
public EcsPool<T> UncheckedGetPool<T>() where T : struct;
|
|
||||||
|
|
||||||
public bool IsMaskCompatible<TInc>(int entity) where TInc : struct, IInc;
|
public bool IsMaskCompatible<TInc>(int entity) where TInc : struct, IInc;
|
||||||
public bool IsMaskCompatible<TInc, TExc>(int entity) where TInc : struct, IInc where TExc : struct, IExc;
|
public bool IsMaskCompatible<TInc, TExc>(int entity) where TInc : struct, IInc where TExc : struct, IExc;
|
||||||
@ -26,23 +23,10 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool IsMaskCompatibleWithout(EcsComponentMask mask, int entity, int otherPoolID);
|
public bool IsMaskCompatibleWithout(EcsComponentMask mask, int entity, int otherPoolID);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
|
||||||
internal int Count { get; }
|
|
||||||
internal int Capacity { get; }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Internal Methods
|
#region Internal Methods
|
||||||
internal void OnEntityComponentAdded(int entityID, int changedPoolID);
|
internal void OnEntityComponentAdded(int entityID, int changedPoolID);
|
||||||
internal void OnEntityComponentRemoved(int entityID, int changedPoolID);
|
internal void OnEntityComponentRemoved(int entityID, int changedPoolID);
|
||||||
internal void RegisterGroup(EcsGroup group);
|
internal void RegisterGroup(EcsGroup group);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IEcsReadonlyEntityComponentTableExtensions
|
|
||||||
{
|
|
||||||
public static bool IsNullOrEmpty(this IEcsReadonlyTable self)
|
|
||||||
{
|
|
||||||
return self == null || self.Count <= 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user