Files
TEngine/Assets/GameScripts/DotNet/Core/Entity/IAddComponentSystem.cs
ALEXTANG 336d4b2eb9 [+] 接入ET8服务端
[+] 接入ET8服务端
2023-07-13 12:23:48 +08:00

40 lines
688 B
C#

using System;
namespace ET
{
public interface IAddComponent
{
}
public interface IAddComponentSystem: ISystemType
{
void Run(Entity o, Entity component);
}
[EntitySystem]
public abstract class AddComponentSystem<T> : IAddComponentSystem where T: Entity, IAddComponent
{
void IAddComponentSystem.Run(Entity o, Entity component)
{
this.AddComponent((T)o, component);
}
Type ISystemType.SystemType()
{
return typeof(IAddComponentSystem);
}
int ISystemType.GetInstanceQueueIndex()
{
return InstanceQueueIndex.None;
}
Type ISystemType.Type()
{
return typeof(T);
}
protected abstract void AddComponent(T self, Entity component);
}
}