private void Validate() { if (entityMap.Count == 0) { throw new InvalidOperationException("No entities registered to scene"); } if (entityMap.CountEntities(e => e.ContainsComponent(ComponentTypeManager.GetKeyPart <CameraComponent>())) == 0) { LogEvent.Engine.Warning("No camera registered to scene"); } if (entityMap.CountEntities(e => e.ContainsComponent(ComponentTypeManager.GetKeyPart <PointLightComponent>())) == 0) { LogEvent.Engine.Warning("No light registered to scene"); } if (!entityMap.Validate()) { throw new InvalidOperationException("Entities are missing required components"); } }
public bool ContainsComponent <TComponent>() where TComponent : IComponent { return(ContainsComponent(ComponentTypeManager.GetKeyPart <TComponent>())); }
public TComponent GetComponent <TComponent>() where TComponent : Component { return(GetComponent <TComponent>(ComponentTypeManager.GetKeyPart <TComponent>())); }
public bool TryGetComponent <TComponent>(out TComponent component) where TComponent : Component { return(Scene.EntityMap.TryGetEntityComponent(this, ComponentTypeManager.GetKeyPart <TComponent>(), out component)); }