diff --git a/Engine.Core/Abstract/ITransform.cs b/Engine.Core/Abstract/ITransform.cs
index a52e39c..a64522b 100644
--- a/Engine.Core/Abstract/ITransform.cs
+++ b/Engine.Core/Abstract/ITransform.cs
@@ -6,7 +6,7 @@ namespace Syntriax.Engine.Core.Abstract;
///
/// Represents the transformation properties of an object such as position, scale, and rotation.
///
-public interface ITransform : IEnumerable
+public interface ITransform : IAssignableGameObject, IEnumerable
{
///
/// Event triggered when the of the changes.
diff --git a/Engine.Core/Abstract/ITransformWithGameObject.cs b/Engine.Core/Abstract/ITransformWithGameObject.cs
deleted file mode 100644
index 31190d3..0000000
--- a/Engine.Core/Abstract/ITransformWithGameObject.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Syntriax.Engine.Core.Abstract;
-
-///
-/// Represents an attached to an .
-///
-public interface ITransformWithGameObject : ITransform, IAssignableGameObject { }
diff --git a/Engine.Core/Factory/GameObjectFactory.cs b/Engine.Core/Factory/GameObjectFactory.cs
index 56237c0..6713d39 100644
--- a/Engine.Core/Factory/GameObjectFactory.cs
+++ b/Engine.Core/Factory/GameObjectFactory.cs
@@ -9,7 +9,7 @@ public class GameObjectFactory
=> Instantiate(transform: null, behaviourController: null, stateEnable: null, args);
public T Instantiate(
- ITransformWithGameObject? transform = null,
+ ITransform? transform = null,
IBehaviourController? behaviourController = null,
IStateEnable? stateEnable = null,
params object?[]? args
@@ -18,7 +18,7 @@ public class GameObjectFactory
{
T gameObject = TypeFactory.Get(args);
- transform ??= TypeFactory.Get();
+ transform ??= TypeFactory.Get();
behaviourController ??= TypeFactory.Get();
stateEnable ??= TypeFactory.Get();
diff --git a/Engine.Core/Transform.cs b/Engine.Core/Transform.cs
index 4a0c54d..6007b34 100644
--- a/Engine.Core/Transform.cs
+++ b/Engine.Core/Transform.cs
@@ -6,9 +6,13 @@ using Syntriax.Engine.Core.Abstract;
namespace Syntriax.Engine.Core;
-[System.Diagnostics.DebuggerDisplay("Position: {Position.ToString(), nq}, Scale: {Scale.ToString(), nq}, Rotation: {Rotation}")]
+[System.Diagnostics.DebuggerDisplay("Name: {GameObject.Name, nq} Position: {Position.ToString(), nq}, Scale: {Scale.ToString(), nq}, Rotation: {Rotation}")]
public class Transform : ITransform
{
+ public Action? OnGameObjectAssigned { get; set; } = null;
+
+ public Action? OnUnassigned { get; set; } = null;
+
public Action? OnPositionChanged { get; set; } = null;
public Action? OnScaleChanged { get; set; } = null;
public Action? OnRotationChanged { get; set; } = null;
@@ -28,6 +32,7 @@ public class Transform : ITransform
private readonly List _children = [];
+ public IGameObject GameObject { get; private set; } = null!;
public ITransform? Parent { get; private set; } = null;
public IReadOnlyList Children => _children;
@@ -245,4 +250,24 @@ public class Transform : ITransform
else
_rotation = Parent.Rotation + LocalRotation;
}
+
+ public bool Assign(IGameObject gameObject)
+ {
+ if (GameObject is not null && GameObject.Initialized)
+ return false;
+
+ GameObject = gameObject;
+ OnGameObjectAssigned?.Invoke(this);
+ return true;
+ }
+
+ public bool Unassign()
+ {
+ if (GameObject is not null && GameObject.Initialized)
+ return false;
+
+ GameObject = null!;
+ OnUnassigned?.Invoke(this);
+ return true;
+ }
}
diff --git a/Engine.Core/TransformWithGameObject.cs b/Engine.Core/TransformWithGameObject.cs
deleted file mode 100644
index a511d7f..0000000
--- a/Engine.Core/TransformWithGameObject.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-
-using Syntriax.Engine.Core.Abstract;
-
-namespace Syntriax.Engine.Core;
-
-[System.Diagnostics.DebuggerDisplay("Name: {GameObject.Name, nq} Position: {Position.ToString(), nq}, Scale: {Scale.ToString(), nq}, Rotation: {Rotation}")]
-public class TransformWithGameObject : Transform, ITransformWithGameObject
-{
- public Action? OnGameObjectAssigned { get; set; } = null;
-
- public Action? OnUnassigned { get; set; } = null;
-
-
- public IGameObject GameObject { get; private set; } = null!;
-
-
- public bool Assign(IGameObject gameObject)
- {
- if (GameObject is not null && GameObject.Initialized)
- return false;
-
- GameObject = gameObject;
- OnGameObjectAssigned?.Invoke(this);
- return true;
- }
-
- public bool Unassign()
- {
- if (GameObject is not null && GameObject.Initialized)
- return false;
-
- GameObject = null!;
- OnUnassigned?.Invoke(this);
- return true;
- }
-}