remove usless

This commit is contained in:
Mikhail 2023-04-07 19:23:07 +08:00
parent 9e865ffdbe
commit 53b7fae2c4
4 changed files with 8 additions and 97 deletions

View File

@ -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
}
}

View File

@ -1,5 +1,4 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using delayedOp = System.Int32;
@ -184,11 +183,6 @@ namespace DCFApixels.DragonECS
Array.Resize(ref _sparse, newSize);
}
//TODO добавить метод Sort
//TODO добавить автосоритровку при каждом GetEnumerator и проверить будет ли прирост производительности или ее падение.
//Суть в том что так возможно можно будет более плотно подавать данные в проц
public void Sort()
{
int increment = 1;
@ -202,7 +196,6 @@ namespace DCFApixels.DragonECS
}
}
#region AddGroup/RemoveGroup
public void AddGroup(EcsReadonlyGroup group)
{ foreach (var item in group) Add(item.id); }
@ -248,7 +241,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Enumerator GetEnumerator()
{
// Sort();
Sort();
_lockCount++;
return new Enumerator(this);
}
@ -283,10 +276,10 @@ namespace DCFApixels.DragonECS
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Dispose() => _source.Unlock();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Reset() { }
public void Dispose()
{
_source.Unlock();
}
}
#endregion
}

View File

@ -65,7 +65,6 @@ namespace DCFApixels.DragonECS
private short[] _gens; //старший бит указывает на то жива ли сущьность.
//private short[] _componentCounts; //TODO
private IEcsPool[] _pools;
private EcsNullPool _nullPool;
@ -154,10 +153,7 @@ namespace DCFApixels.DragonECS
}
return (EcsPool<T>)_pools[uniqueID];
}
public EcsPool<T> UncheckedGetPool<T>() where T : struct
{
return (EcsPool<T>)_pools[ComponentType<T>.uniqueID];
}
//public EcsPool<T> UncheckedGetPool<T>() where T : struct => (EcsPool<T>)_pools[ComponentType<T>.uniqueID];
#endregion
#region Entities

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DCFApixels.DragonECS
{
@ -11,6 +7,8 @@ namespace DCFApixels.DragonECS
#region Properties
/// <summary>Table Archetype</summary>
public Type ArchetypeType { get; }
internal int Count { get; }
internal int Capacity { get; }
#endregion
#region Methods
@ -18,7 +16,6 @@ namespace DCFApixels.DragonECS
public int GetComponentID<T>();
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, 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);
#endregion
#region Properties
internal int Count { get; }
internal int Capacity { get; }
#endregion
#region Internal Methods
internal void OnEntityComponentAdded(int entityID, int changedPoolID);
internal void OnEntityComponentRemoved(int entityID, int changedPoolID);
internal void RegisterGroup(EcsGroup group);
#endregion
}
public static class IEcsReadonlyEntityComponentTableExtensions
{
public static bool IsNullOrEmpty(this IEcsReadonlyTable self)
{
return self == null || self.Count <= 0;
}
}
}