chore: removed unused code piece from HierarchyObject

This commit is contained in:
Syntriax 2025-04-01 19:19:06 +03:00
parent c71bf71fb3
commit 5756b96002

View File

@ -77,7 +77,6 @@ public class HierarchyObject : BaseEntity, IHierarchyObject
if (previousParent is not null) if (previousParent is not null)
{ {
previousParent.RemoveChild(this); previousParent.RemoveChild(this);
previousParent.OnParentChanged -= NotifyChildrenOnParentChange;
previousParent.OnActiveChanged -= OnParentActiveChanged; previousParent.OnActiveChanged -= OnParentActiveChanged;
} }
@ -86,7 +85,6 @@ public class HierarchyObject : BaseEntity, IHierarchyObject
if (parent is not null) if (parent is not null)
{ {
parent.AddChild(this); parent.AddChild(this);
parent.OnParentChanged += NotifyChildrenOnParentChange;
parent.OnActiveChanged += OnParentActiveChanged; parent.OnActiveChanged += OnParentActiveChanged;
} }
@ -113,14 +111,6 @@ public class HierarchyObject : BaseEntity, IHierarchyObject
OnChildrenRemoved?.Invoke(this, parent); OnChildrenRemoved?.Invoke(this, parent);
} }
private void NotifyChildrenOnParentChange(IHierarchyObject sender, IHierarchyObject? previousParent, IHierarchyObject? newParent)
{
// TODO No idea how logical this is to propagate this to the children the way I'm doing right now.
// I was originally gonna just call `child.OnParentChanged?.Invoke(child, child.parentTransform);` but seems an unnecessary call too?
foreach (IHierarchyObject child in Children) // TODO CHECK ERRORS
child.SetParent(this);
}
protected virtual void OnAssign(IBehaviourController behaviourController) { } protected virtual void OnAssign(IBehaviourController behaviourController) { }
public bool Assign(IBehaviourController behaviourController) public bool Assign(IBehaviourController behaviourController)
{ {