Example #1
0
        public void RemoveComponent(ActorComponent component)
        {
            if (!_Components.Remove(component))
            {
                return;
            }

            if (RootComponent == component)
            {
                RootComponent = null;
            }

            component.RemoveRef(this);
            UnregisterComponentName(component);
        }
Example #2
0
        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();
        }
Example #3
0
        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());
        }
Example #4
0
 public bool CanAttach(SceneComponent child)
 {
     return(true);
 }