Exemplo n.º 1
0
 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");
     }
 }
Exemplo n.º 2
0
        public bool ContainsComponent <TComponent>()
            where TComponent : IComponent

        {
            return(ContainsComponent(ComponentTypeManager.GetKeyPart <TComponent>()));
        }
Exemplo n.º 3
0
 public TComponent GetComponent <TComponent>()
     where TComponent : Component
 {
     return(GetComponent <TComponent>(ComponentTypeManager.GetKeyPart <TComponent>()));
 }
Exemplo n.º 4
0
 public bool TryGetComponent <TComponent>(out TComponent component)
     where TComponent : Component
 {
     return(Scene.EntityMap.TryGetEntityComponent(this, ComponentTypeManager.GetKeyPart <TComponent>(), out component));
 }