mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
change hybrid component interface
This commit is contained in:
parent
eddbe6b150
commit
ded1c58296
@ -64,7 +64,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
this.IncrementEntityComponentCount(entityID);
|
this.IncrementEntityComponentCount(entityID);
|
||||||
_listeners.InvokeOnAdd(entityID);
|
_listeners.InvokeOnAdd(entityID);
|
||||||
component.OnAddToPool();
|
component.OnAddToPool(_source.GetEntityLong(entityID));
|
||||||
_items[itemIndex] = component;
|
_items[itemIndex] = component;
|
||||||
}
|
}
|
||||||
public void Set(int entityID, T component)
|
public void Set(int entityID, T component)
|
||||||
@ -88,10 +88,10 @@ namespace DCFApixels.DragonECS
|
|||||||
else
|
else
|
||||||
{//not null
|
{//not null
|
||||||
_listeners.InvokeOnDel(entityID);
|
_listeners.InvokeOnDel(entityID);
|
||||||
_items[itemIndex].OnDelFromPool();
|
_items[itemIndex].OnDelFromPool(_source.GetEntityLong(entityID));
|
||||||
}
|
}
|
||||||
_listeners.InvokeOnAdd(entityID);
|
_listeners.InvokeOnAdd(entityID);
|
||||||
component.OnAddToPool();
|
component.OnAddToPool(_source.GetEntityLong(entityID));
|
||||||
_items[itemIndex] = component;
|
_items[itemIndex] = component;
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@ -123,7 +123,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#endif
|
#endif
|
||||||
ref int itemIndex = ref _mapping[entityID];
|
ref int itemIndex = ref _mapping[entityID];
|
||||||
T component = _items[itemIndex];
|
T component = _items[itemIndex];
|
||||||
component.OnDelFromPool();
|
component.OnDelFromPool(_source.GetEntityLong(entityID));
|
||||||
if (_recycledItemsCount >= _recycledItems.Length)
|
if (_recycledItemsCount >= _recycledItems.Length)
|
||||||
Array.Resize(ref _recycledItems, _recycledItems.Length << 1);
|
Array.Resize(ref _recycledItems, _recycledItems.Length << 1);
|
||||||
_recycledItems[_recycledItemsCount++] = itemIndex;
|
_recycledItems[_recycledItemsCount++] = itemIndex;
|
||||||
@ -193,9 +193,8 @@ namespace DCFApixels.DragonECS
|
|||||||
public interface IEcsHybridComponent
|
public interface IEcsHybridComponent
|
||||||
{
|
{
|
||||||
bool IsAlive { get; }
|
bool IsAlive { get; }
|
||||||
entlong Entity { set; }
|
void OnAddToPool(entlong entity);
|
||||||
void OnAddToPool();
|
void OnDelFromPool(entlong entity);
|
||||||
void OnDelFromPool();
|
|
||||||
}
|
}
|
||||||
public static class EcsHybridPoolExt
|
public static class EcsHybridPoolExt
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user