mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
add EcsWorld.InitEntitySlot
This commit is contained in:
parent
d970212c23
commit
32ed705fc4
@ -389,7 +389,16 @@ namespace DCFApixels.DragonECS
|
|||||||
return *(entlong*)&x;
|
return *(entlong*)&x;
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe EntitySlotInfo GetEntitySlotInfoDebug(int entityID)
|
public void InitEntitySlot(int entityID, short gen)
|
||||||
|
{
|
||||||
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
|
if (Count > 0) { Throw.World_MethodCalledAfterEntityCreation(nameof(InitEntitySlot)); }
|
||||||
|
#endif
|
||||||
|
_entityDispenser.Upsize(entityID);
|
||||||
|
_entities[entityID].gen = gen;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public EntitySlotInfo GetEntitySlotInfoDebug(int entityID)
|
||||||
{
|
{
|
||||||
return new EntitySlotInfo(entityID, _entities[entityID].gen, ID);
|
return new EntitySlotInfo(entityID, _entities[entityID].gen, ID);
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,11 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
{
|
{
|
||||||
throw new EcsFrameworkException("This world can't be destroyed");
|
throw new EcsFrameworkException("This world can't be destroyed");
|
||||||
}
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
|
public static void World_MethodCalledAfterEntityCreation(string methodName)
|
||||||
|
{
|
||||||
|
throw new EcsFrameworkException($"The method {methodName} can only be executed before creating entities in the world.");
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void Ent_ThrowIsNotAlive(entlong entity)
|
internal static void Ent_ThrowIsNotAlive(entlong entity)
|
||||||
|
Loading…
Reference in New Issue
Block a user