public void RemoveComponent(ActorComponent component) { if (!_Components.Remove(component)) { return; } if (RootComponent == component) { RootComponent = null; } component.RemoveRef(this); UnregisterComponentName(component); }
public void AddComponent(SceneComponent child) { if (!CanAttach(child)) { throw new InvalidOperationException("Can't attach this child"); } _Components.Add(child); child.AddRef(child); child.Parent = this; child.SetParents(); Actor?.RegisterComponentName(child); child.UpdateParent(); child.OnAttached(); }
public void RemoveComponent(SceneComponent child) { if (child.Parent == null) { return; } if (!_Components.Remove(child)) { return; } child.RemoveRef(this); child.Parent = null; Actor?.RegisterComponentName(child); child.Visit <ActorComponent>(c => c.Deallocate()); }
public bool CanAttach(SceneComponent child) { return(true); }