mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
remove world interface
This commit is contained in:
parent
65861cb798
commit
cb25943b55
@ -17,7 +17,7 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public IEcsWorld World
|
||||
public EcsWorld World
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _source.World;
|
||||
|
@ -12,7 +12,6 @@ namespace DCFApixels.DragonECS
|
||||
private EcsWorld _targetWorld;
|
||||
private EcsAttachPool<TAttachComponent> _targetPool;
|
||||
|
||||
|
||||
private int _targetWorldCapacity = -1;
|
||||
private int _targetPoolCapacity = -1;
|
||||
|
||||
@ -45,6 +44,8 @@ namespace DCFApixels.DragonECS
|
||||
public sealed override void ExecuteJoin()
|
||||
{
|
||||
_execute.Begin();
|
||||
|
||||
_isJoinExecuted = false;
|
||||
if (_isInitTargetWorlds == false)
|
||||
{
|
||||
InitTargetWorlds();
|
||||
|
@ -5,22 +5,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IEcsWorld : IEcsTable
|
||||
{
|
||||
#region Properties
|
||||
public int UniqueID { get; }
|
||||
public EcsPipeline Pipeline { get; }
|
||||
#endregion
|
||||
|
||||
#region Entities
|
||||
public EcsEntity NewEntity();
|
||||
public void DelEntity(EcsEntity entity);
|
||||
public bool EntityIsAlive(int entityID, short gen);
|
||||
public EcsEntity GetEcsEntity(int entityID);
|
||||
#endregion
|
||||
}
|
||||
|
||||
public abstract class EcsWorld : IEcsWorld
|
||||
public abstract class EcsWorld
|
||||
{
|
||||
private const short GEN_BITS = 0x7fff;
|
||||
private const short DEATH_GEN_BIT = short.MinValue;
|
||||
@ -265,19 +250,16 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region Groups
|
||||
void IEcsTable.RegisterGroup(EcsGroup group) => RegisterGroup(group);
|
||||
internal void RegisterGroup(EcsGroup group)
|
||||
{
|
||||
_groups.Add(new WeakReference<EcsGroup>(group));
|
||||
}
|
||||
EcsGroup IEcsTable.GetGroupFromPool() => GetGroupFromPool();
|
||||
internal EcsGroup GetGroupFromPool()
|
||||
{
|
||||
if (_groupsPool.Count <= 0)
|
||||
return new EcsGroup(this);
|
||||
return _groupsPool.Pop();
|
||||
}
|
||||
void IEcsTable.ReleaseGroup(EcsGroup group) => ReleaseGroup(group);
|
||||
internal void ReleaseGroup(EcsGroup group)
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
|
@ -1,34 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IEcsTable
|
||||
{
|
||||
#region Properties
|
||||
/// <summary>Table Archetype</summary>
|
||||
public Type Archetype { get; }
|
||||
public int Count { get; }
|
||||
public int Capacity { get; }
|
||||
public EcsReadonlyGroup Entities => default;
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public int GetComponentID<T>();
|
||||
public TPool GetPool<TComponent, TPool>() where TComponent : struct where TPool : EcsPoolBase<TComponent>, new();
|
||||
public ReadOnlySpan<EcsPoolBase> GetAllPools();
|
||||
public TQuery Select<TQuery>() where TQuery : EcsQueryBase;
|
||||
public TQuery Where<TQuery>(out TQuery query) where TQuery : EcsQuery;
|
||||
// public TQuery Join<TQuery>(out TQuery query) where TQuery : EcsJoinQueryBase;
|
||||
|
||||
public bool IsMaskCompatible(EcsComponentMask mask, int entityID);
|
||||
|
||||
public void Destroy();
|
||||
#endregion
|
||||
|
||||
#region Internal Methods
|
||||
internal void RegisterGroup(EcsGroup group);
|
||||
internal EcsGroup GetGroupFromPool();
|
||||
internal void ReleaseGroup(EcsGroup group);
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user