diff --git a/Engine.Core/Abstract/ITransform.cs b/Engine.Core/Abstract/ITransform.cs
index f78adb8..724bc4a 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 : IAssignableGameObject, IEnumerable
+public interface ITransform : IEnumerable
{
///
/// Event triggered when the of the changes.
diff --git a/Engine.Core/Abstract/ITransformWithGameObject.cs b/Engine.Core/Abstract/ITransformWithGameObject.cs
new file mode 100644
index 0000000..31190d3
--- /dev/null
+++ b/Engine.Core/Abstract/ITransformWithGameObject.cs
@@ -0,0 +1,6 @@
+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 6713d39..56237c0 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(
- ITransform? transform = null,
+ ITransformWithGameObject? 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 6007b34..4a0c54d 100644
--- a/Engine.Core/Transform.cs
+++ b/Engine.Core/Transform.cs
@@ -6,13 +6,9 @@ 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}")]
+[System.Diagnostics.DebuggerDisplay("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;
@@ -32,7 +28,6 @@ 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;
@@ -250,24 +245,4 @@ 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
new file mode 100644
index 0000000..a511d7f
--- /dev/null
+++ b/Engine.Core/TransformWithGameObject.cs
@@ -0,0 +1,37 @@
+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;
+ }
+}