Skip to content

Commit c2bb7ba

Browse files
[WIP] Add Entity Component to Entities via EntityInspectorView (#295)
* [WIP] Add Entity Component to Entities via `EntityInspectorView` * Getting there * Fixed styling issue * Fix
1 parent 265213c commit c2bb7ba

16 files changed

+351
-90
lines changed

FinalEngine.ECS.Components/Core/TagComponent.cs

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
// <copyright file="TagComponent.cs" company="Software Antics">
2-
// Copyright (c) Software Antics. All rights reserved.
2+
// Copyright (c) Software Antics. All rights reserved.
33
// </copyright>
44

55
namespace FinalEngine.ECS.Components.Core;
66

77
using System.ComponentModel;
88

99
/// <summary>
10-
/// Provides a component that represents a name or tag for an <see cref="Entity"/>.
10+
/// Provides a component that represents a name or tag for an <see cref="Entity"/>.
1111
/// </summary>
12-
/// <seealso cref="IEntityComponent" />
12+
/// <seealso cref="IEntityComponent"/>
13+
[Category("Core")]
1314
public sealed class TagComponent : IEntityComponent, INotifyPropertyChanged
1415
{
1516
/// <summary>
16-
/// The tag.
17+
/// The tag.
1718
/// </summary>
1819
private string? tag;
1920

2021
/// <summary>
21-
/// Occurs when a property value changes.
22+
/// Occurs when a property value changes.
2223
/// </summary>
2324
public event PropertyChangedEventHandler? PropertyChanged;
2425

2526
/// <summary>
26-
/// Gets or sets the tag.
27+
/// Gets or sets the tag.
2728
/// </summary>
2829
/// <value>
29-
/// The tag.
30+
/// The tag.
3031
/// </value>
3132
public string? Tag
3233
{

FinalEngine.ECS.Components/Core/TransformComponent.cs

+34-32
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44

55
namespace FinalEngine.ECS.Components.Core;
66

7+
using System.ComponentModel;
78
using System.Numerics;
89

910
/// <summary>
10-
/// Provides a component that represents the translation, rotation and scale of an entity.
11+
/// Provides a component that represents the translation, rotation and scale of an entity.
1112
/// </summary>
12-
/// <seealso cref="IEntityComponent" />
13+
/// <seealso cref="IEntityComponent"/>
14+
[Category("Core")]
1315
public sealed class TransformComponent : IEntityComponent
1416
{
1517
/// <summary>
16-
/// Initializes a new instance of the <see cref="TransformComponent"/> class.
18+
/// Initializes a new instance of the <see cref="TransformComponent"/> class.
1719
/// </summary>
1820
public TransformComponent()
1921
{
@@ -23,100 +25,100 @@ public TransformComponent()
2325
}
2426

2527
/// <summary>
26-
/// Gets a normalized vector representing the negative Z-axis of the transform in world space.
28+
/// Gets a normalized vector representing the negative Z-axis of the transform in world space.
2729
/// </summary>
2830
/// <value>
29-
/// The normalized vector representing the Z-axis of the transform in world space..
31+
/// The normalized vector representing the Z-axis of the transform in world space..
3032
/// </value>
3133
public Vector3 Backward
3234
{
3335
get { return Vector3.Normalize(Vector3.Transform(-Vector3.UnitZ, this.Rotation)); }
3436
}
3537

3638
/// <summary>
37-
/// Gets a normalized vector representing the negative Y-axis of the transform in world space.
39+
/// Gets a normalized vector representing the negative Y-axis of the transform in world space.
3840
/// </summary>
3941
/// <value>
40-
/// The normalized vector representing the negative Y-axis of the transform in world space.
42+
/// The normalized vector representing the negative Y-axis of the transform in world space.
4143
/// </value>
4244
public Vector3 Down
4345
{
4446
get { return Vector3.Normalize(Vector3.Transform(-Vector3.UnitY, this.Rotation)); }
4547
}
4648

4749
/// <summary>
48-
/// Gets a normalized vector representing the Z-axis of the transform in world space.
50+
/// Gets a normalized vector representing the Z-axis of the transform in world space.
4951
/// </summary>
5052
/// <value>
51-
/// The normalized vector representing the Z-axis of the transform in world space..
53+
/// The normalized vector representing the Z-axis of the transform in world space..
5254
/// </value>
5355
public Vector3 Forward
5456
{
5557
get { return Vector3.Normalize(Vector3.Transform(Vector3.UnitZ, this.Rotation)); }
5658
}
5759

5860
/// <summary>
59-
/// Gets a normalized vector representing the negative X-axis of the transform in world space.
61+
/// Gets a normalized vector representing the negative X-axis of the transform in world space.
6062
/// </summary>
6163
/// <value>
62-
/// The normalized vector representing the negative X-axis of the transform in world space.
64+
/// The normalized vector representing the negative X-axis of the transform in world space.
6365
/// </value>
6466
public Vector3 Left
6567
{
6668
get { return Vector3.Normalize(Vector3.Transform(-Vector3.UnitX, this.Rotation)); }
6769
}
6870

6971
/// <summary>
70-
/// Gets or sets the position of the transform.
72+
/// Gets or sets the position of the transform.
7173
/// </summary>
7274
/// <value>
73-
/// The position of the transform.
75+
/// The position of the transform.
7476
/// </value>
7577
public Vector3 Position { get; set; }
7678

7779
/// <summary>
78-
/// Gets a normalized vector representing the X-axis of the transform in world space.
80+
/// Gets a normalized vector representing the X-axis of the transform in world space.
7981
/// </summary>
8082
/// <value>
81-
/// The normalized vector representing the negative X-axis of the transform in world space.
83+
/// The normalized vector representing the negative X-axis of the transform in world space.
8284
/// </value>
8385
public Vector3 Right
8486
{
8587
get { return Vector3.Normalize(Vector3.Transform(Vector3.UnitX, this.Rotation)); }
8688
}
8789

8890
/// <summary>
89-
/// Gets or sets the rotation of this transform.
91+
/// Gets or sets the rotation of this transform.
9092
/// </summary>
9193
/// <value>
92-
/// The rotation of this transform.
94+
/// The rotation of this transform.
9395
/// </value>
9496
public Quaternion Rotation { get; set; }
9597

9698
/// <summary>
97-
/// Gets or sets the scale.
99+
/// Gets or sets the scale.
98100
/// </summary>
99101
/// <value>
100-
/// The scale.
102+
/// The scale.
101103
/// </value>
102104
public Vector3 Scale { get; set; }
103105

104106
/// <summary>
105-
/// Gets a normalized vector representing the Y-axis of the transform in world space.
107+
/// Gets a normalized vector representing the Y-axis of the transform in world space.
106108
/// </summary>
107109
/// <value>
108-
/// The normalized vector representing the negative Y-axis of the transform in world space.
110+
/// The normalized vector representing the negative Y-axis of the transform in world space.
109111
/// </value>
110112
public Vector3 Up
111113
{
112114
get { return Vector3.Normalize(Vector3.Transform(Vector3.UnitY, this.Rotation)); }
113115
}
114116

115117
/// <summary>
116-
/// Creates the transformation matrix for this transform.
118+
/// Creates the transformation matrix for this transform.
117119
/// </summary>
118120
/// <returns>
119-
/// The newly create <see cref="Matrix4x4"/> that represents the transformation matrix for this transform.
121+
/// The newly create <see cref="Matrix4x4"/> that represents the transformation matrix for this transform.
120122
/// </returns>
121123
public Matrix4x4 CreateTransformationMatrix()
122124
{
@@ -126,27 +128,27 @@ public Matrix4x4 CreateTransformationMatrix()
126128
}
127129

128130
/// <summary>
129-
/// Creates the view matrix for this transform.
131+
/// Creates the view matrix for this transform.
130132
/// </summary>
131133
/// <param name="cameraUp">
132-
/// The camera up vector.
134+
/// The camera up vector.
133135
/// </param>
134136
/// <returns>
135-
/// The newly created <see cref="Matrix4x4"/> that represents the view matrix for this transform.
137+
/// The newly created <see cref="Matrix4x4"/> that represents the view matrix for this transform.
136138
/// </returns>
137139
public Matrix4x4 CreateViewMatrix(Vector3 cameraUp)
138140
{
139141
return Matrix4x4.CreateLookAt(this.Position, this.Position + this.Forward, cameraUp);
140142
}
141143

142144
/// <summary>
143-
/// Rotates this transform on the specified <paramref name="axis"/> by the specified <paramref name="radians"/>.
145+
/// Rotates this transform on the specified <paramref name="axis"/> by the specified <paramref name="radians"/>.
144146
/// </summary>
145147
/// <param name="axis">
146-
/// The axis to rotate.
148+
/// The axis to rotate.
147149
/// </param>
148150
/// <param name="radians">
149-
/// The radians that represents the amount to rotate by.
151+
/// The radians that represents the amount to rotate by.
150152
/// </param>
151153
public void Rotate(Vector3 axis, float radians)
152154
{
@@ -155,13 +157,13 @@ public void Rotate(Vector3 axis, float radians)
155157
}
156158

157159
/// <summary>
158-
/// Translates this transform in the specified <paramref name="direction"/> by the specified <paramref name="amount"/>.
160+
/// Translates this transform in the specified <paramref name="direction"/> by the specified <paramref name="amount"/>.
159161
/// </summary>
160162
/// <param name="direction">
161-
/// The direction to translate.
163+
/// The direction to translate.
162164
/// </param>
163165
/// <param name="amount">
164-
/// The amount to translate.
166+
/// The amount to translate.
165167
/// </param>
166168
public void Translate(Vector3 direction, float amount)
167169
{

FinalEngine.ECS.Components/FinalEngine.ECS.Components.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<Platforms>x64</Platforms>
11-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1211
</PropertyGroup>
1312

1413
<ItemGroup>

FinalEngine.Editor.Common/FinalEngine.Editor.Common.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<Platforms>x64</Platforms>
11-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1211
</PropertyGroup>
1312

1413
<ItemGroup>

FinalEngine.Editor.Common/Models/Scenes/Scene.cs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// <copyright file="Scene.cs" company="Software Antics">
2-
// Copyright (c) Software Antics. All rights reserved.
2+
// Copyright (c) Software Antics. All rights reserved.
33
// </copyright>
44

55
namespace FinalEngine.Editor.Common.Models.Scenes;
@@ -14,36 +14,36 @@ namespace FinalEngine.Editor.Common.Models.Scenes;
1414
using Microsoft.Extensions.Logging;
1515

1616
/// <summary>
17-
/// Represents a scene that contains a collection of entities and systems.
17+
/// Represents a scene that contains a collection of entities and systems.
1818
/// </summary>
1919
public sealed class Scene : IScene
2020
{
2121
/// <summary>
22-
/// The entities contained within the scene.
22+
/// The entities contained within the scene.
2323
/// </summary>
2424
private readonly ObservableCollection<Entity> entities;
2525

2626
/// <summary>
27-
/// The logger.
27+
/// The logger.
2828
/// </summary>
2929
private readonly ILogger<Scene> logger;
3030

3131
/// <summary>
32-
/// The underlying entity world that contains all the scenes entities and systems.
32+
/// The underlying entity world that contains all the scenes entities and systems.
3333
/// </summary>
3434
private readonly IEntityWorld world;
3535

3636
/// <summary>
37-
/// Initializes a new instance of the <see cref="Scene"/> class.
37+
/// Initializes a new instance of the <see cref="Scene"/> class.
3838
/// </summary>
3939
/// <param name="logger">
40-
/// The logger.
40+
/// The logger.
4141
/// </param>
4242
/// <param name="world">
43-
/// The entity world to be associated with this scene.
43+
/// The entity world to be associated with this scene.
4444
/// </param>
4545
/// <exception cref="ArgumentNullException">
46-
/// The specified <paramref name="logger"/> or <paramref name="world"/> parameter cannot be null.
46+
/// The specified <paramref name="logger"/> or <paramref name="world"/> parameter cannot be null.
4747
/// </exception>
4848
public Scene(ILogger<Scene> logger, IEntityWorld world)
4949
{
@@ -60,7 +60,7 @@ public IReadOnlyCollection<Entity> Entities
6060

6161
/// <inheritdoc/>
6262
/// <exception cref="ArgumentException">
63-
/// The specified <paramref name="tag"/> parameter cannot be null or whitespace.
63+
/// The specified <paramref name="tag"/> parameter cannot be null or whitespace.
6464
/// </exception>
6565
public void AddEntity(string tag, Guid uniqueID)
6666
{
@@ -88,7 +88,7 @@ public void AddEntity(string tag, Guid uniqueID)
8888

8989
/// <inheritdoc/>
9090
/// <exception cref="ArgumentException">
91-
/// Failed to locate an <see cref="Entity"/> that matches the specified <paramref name="uniqueIdentifier"/>.
91+
/// Failed to locate an <see cref="Entity"/> that matches the specified <paramref name="uniqueIdentifier"/>.
9292
/// </exception>
9393
public void RemoveEntity(Guid uniqueIdentifier)
9494
{

0 commit comments

Comments
 (0)