continuation of implementing ECS
This commit is contained in:
11
src/EngineSharp.Core/EngineSharp.Core/ECS/Entity.cs
Normal file
11
src/EngineSharp.Core/EngineSharp.Core/ECS/Entity.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace EngineSharp.Core.ECS;
|
||||
|
||||
// Maybe look at this C# ECS to get an idea of how to implement one myself
|
||||
// https://github.com/friflo/Friflo.Engine.ECS/tree/main
|
||||
|
||||
public struct Entity
|
||||
{
|
||||
public readonly long Id;
|
||||
|
||||
private List<LogicComponent> _logicComponents;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace EngineSharp.Core.ECS;
|
||||
|
||||
// TODO: A GameObject would have a list of Components. A GameObject is basically what will be stored in the scene graph and all components of all GameObjects will have their Update methods etc. be called
|
||||
|
||||
// Maybe look at this C# ECS to get an idea of how to implement one myself
|
||||
// https://github.com/friflo/Friflo.Engine.ECS/tree/main
|
||||
public abstract class GameObject
|
||||
{
|
||||
private long Id { get; set; }
|
||||
|
||||
public abstract void OnUpdate(double deltaTime);
|
||||
}
|
11
src/EngineSharp.Core/EngineSharp.Core/ECS/LogicComponent.cs
Normal file
11
src/EngineSharp.Core/EngineSharp.Core/ECS/LogicComponent.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace EngineSharp.Core.ECS;
|
||||
|
||||
// TODO: A LogicComponent would have a list of Components. A LogicComponent is basically what will be stored in the scene graph and all components of all LogicComponents will have their Update methods etc. be called
|
||||
|
||||
public abstract class LogicComponent
|
||||
{
|
||||
internal Entity _entity; // the entity this component belongs to
|
||||
|
||||
public abstract void Start();
|
||||
public abstract void OnUpdate(double deltaTime);
|
||||
}
|
Reference in New Issue
Block a user