Refactor entity-component system and related classes

Changed the `Component` class to an interface `IComponentData` to support a data-oriented design.
Changed the `Transform` class from a class to a struct, implementing `IComponentData` and updating properties.
Changed the `GameObject` class to use a dictionary for components and added properties for state management.
Changed the `PlayerLoopService` class to `GameLoopService` and updated methods to integrate with the new `SceneManager`.
Changed the `World` class to manage multiple worlds and enhance entity management with new querying methods.

Added the `Scene` class to manage root game objects and their lifecycle.
Added new utility classes like `ComponentMask`, `Box<T>`, and `TypeHandle<T>` for better component management.
Added the `ScriptComponent` class to allow for modular scriptable components attached to entities.
Added the `QueryEnumerable` class to facilitate flexible querying of entities with specific components.

Updated the `Test` class in `Program.cs` to demonstrate the new entity and component management system.
Updated project files to include new references and settings supporting the changes made in the codebase.
This commit is contained in:
2025-05-28 15:21:43 +09:00
parent 0cf3104a6a
commit 67b6040b5e
31 changed files with 3670 additions and 811 deletions

View File

@@ -8,6 +8,11 @@
</PropertyGroup>
<ItemGroup>
<None Include="Template\QueryItem.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>QueryItem.tt</DependentUpon>
</None>
<None Include="Template\QueryRefComponent.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -27,10 +32,18 @@
</ItemGroup>
<ItemGroup>
<None Update="Template\QueryEnumerable.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>QueryEnumerable.cs</LastGenOutput>
</None>
<None Update="Template\Helpers.tt">
<Generator>TextTemplatingFilePreprocessor</Generator>
<LastGenOutput>Helpers.cs</LastGenOutput>
</None>
<None Update="Template\QueryItem.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>QueryItem.cs</LastGenOutput>
</None>
<None Update="Template\QueryRefComponent.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>QueryRefComponent.cs</LastGenOutput>
@@ -51,6 +64,16 @@
<AutoGen>True</AutoGen>
<DependentUpon>Helpers.tt</DependentUpon>
</Compile>
<Compile Update="Template\QueryEnumerable.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>QueryEnumerable.tt</DependentUpon>
</Compile>
<Compile Update="Template\QueryItem.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>QueryItem.tt</DependentUpon>
</Compile>
<Compile Update="Template\QueryRefComponent.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -63,4 +86,8 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Helpers\" />
</ItemGroup>
</Project>