/// <summary> /// Registers a component with this entity. /// </summary> /// <param name="component">The <see cref="IEntityComponent"/> to register.</param> public void RegisterComponent(IEntityComponent component) { if (component == null) { throw new ArgumentNullException(nameof(component)); } if (!this.componentList.Contains(component)) { this.componentList.Add(component); if (component.Parent?.Id != this.Id) { component.Register(this); } } }