mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-17 17:34:36 +08:00
fixes
This commit is contained in:
parent
c7b8246e09
commit
dc7e1631a4
@ -36,7 +36,7 @@ namespace DCFApixels.DragonECS
|
||||
public bool IsNull
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _values.IsEmpty;
|
||||
get => _worldID == 0;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -18,6 +18,8 @@ namespace DCFApixels.DragonECS
|
||||
public short componentsCount;
|
||||
[FieldOffset(4)]
|
||||
public bool isUsed;
|
||||
//[FieldOffset(5)]
|
||||
//public bool isLocked;
|
||||
public EntitySlot(short gen, short componentsCount, bool isUsed)
|
||||
{
|
||||
this.gen = gen;
|
||||
|
@ -209,6 +209,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void RegisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
|
||||
{
|
||||
UpVersion();
|
||||
_poolComponentCounts[componentTypeID]++;
|
||||
_entities[entityID].componentsCount++;
|
||||
_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] |= maskBit.mask;
|
||||
@ -216,6 +217,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void UnregisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
|
||||
{
|
||||
UpVersion();
|
||||
_poolComponentCounts[componentTypeID]--;
|
||||
var count = --_entities[entityID].componentsCount;
|
||||
_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] &= ~maskBit.mask;
|
||||
|
@ -223,7 +223,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
|
||||
|
||||
[DebuggerTypeProxy(typeof(entlong.DebuggerProxy))]
|
||||
[DebuggerTypeProxy(typeof(DebuggerProxy))]
|
||||
public readonly struct EntitySlotInfo : IEquatable<EntitySlotInfo>
|
||||
{
|
||||
public readonly int id;
|
||||
@ -280,5 +280,31 @@ namespace DCFApixels.DragonECS
|
||||
world = this.world;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
internal class DebuggerProxy
|
||||
{
|
||||
private List<object> _componentsList = new List<object>();
|
||||
private entlong _value;
|
||||
public long full { get { return _value.full; } }
|
||||
public int id { get { return _value.id; } }
|
||||
public int gen { get { return _value.gen; } }
|
||||
public int world { get { return _value.world; } }
|
||||
public EntState State { get { return _value.IsNull ? EntState.Null : _value.IsAlive ? EntState.Alive : EntState.Dead; } }
|
||||
public EcsWorld EcsWorld { get { return EcsWorld.GetWorld(world); } }
|
||||
public IEnumerable<object> components
|
||||
{
|
||||
get
|
||||
{
|
||||
_value.World.GetComponents(_value.ID, _componentsList);
|
||||
return _componentsList;
|
||||
}
|
||||
}
|
||||
public DebuggerProxy(EntitySlotInfo value)
|
||||
{
|
||||
_value = new entlong(value.id, value.gen, value.world);
|
||||
}
|
||||
public enum EntState { Null, Dead, Alive, }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user