fix: IGameObjects Not Being Initialized Properly
This commit is contained in:
@@ -63,6 +63,10 @@ public class GameManager : BaseEntity, IGameManager
|
||||
{
|
||||
_hierarchyObjects.Add(hierarchyObject);
|
||||
hierarchyObject.EnterHierarchy(this);
|
||||
|
||||
if (!hierarchyObject.Initialize())
|
||||
throw new Exception($"{nameof(hierarchyObject)} can't be finalized");
|
||||
|
||||
OnHierarchyObjectRegistered?.Invoke(this, hierarchyObject);
|
||||
}
|
||||
}
|
||||
@@ -85,6 +89,10 @@ public class GameManager : BaseEntity, IGameManager
|
||||
{
|
||||
_hierarchyObjects.Remove(hierarchyObject);
|
||||
hierarchyObject.ExitHierarchy();
|
||||
|
||||
if (!hierarchyObject.Finalize())
|
||||
throw new Exception($"{nameof(hierarchyObject)} can't be finalized");
|
||||
|
||||
OnHierarchyObjectUnRegistered?.Invoke(this, hierarchyObject);
|
||||
}
|
||||
}
|
||||
@@ -138,6 +146,9 @@ public class GameManager : BaseEntity, IGameManager
|
||||
if (!gameObject.EnterHierarchy(this))
|
||||
throw new Exception($"{nameof(gameObject)} can't enter the hierarchy");
|
||||
|
||||
if (!gameObject.Initialize())
|
||||
throw new Exception($"{nameof(gameObject)} can't be initialized");
|
||||
|
||||
OnHierarchyObjectRegistered?.Invoke(this, gameObject);
|
||||
OnGameObjectRegistered?.Invoke(this, gameObject);
|
||||
}
|
||||
@@ -156,6 +167,9 @@ public class GameManager : BaseEntity, IGameManager
|
||||
if (!gameObject.ExitHierarchy())
|
||||
throw new Exception($"{nameof(gameObject)} can't exit the hierarchy");
|
||||
|
||||
if (!gameObject.Finalize())
|
||||
throw new Exception($"{nameof(gameObject)} can't be finalized");
|
||||
|
||||
OnHierarchyObjectUnRegistered?.Invoke(this, gameObject);
|
||||
OnGameObjectUnRegistered?.Invoke(this, gameObject);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user