public static void Run( Ecs.Registry registry, ContentManager contentManager ) { HashSet <Ecs.Entity> entities = registry.GetEntities( typeof(ItemComp) ); foreach (Ecs.Entity entity in entities) { var itemComp = registry .GetComponentUnsafe <ItemComp>(entity); VisibleComp sprite = CreateVisibleComp( itemComp, contentManager ); registry.AssignComponent( entity, sprite ); } }
public static void Run( Ecs.Registry registry, ContentManager contentManager ) { HashSet <Ecs.Entity> entities = registry.GetEntities( typeof(Comps.Door) ); foreach (Ecs.Entity entity in entities) { var obstacleComp = registry .GetComponentUnsafe <Comps.Door>(entity); CompsExt.Visibles.Sprite sprite = CreateVisibleComp( obstacleComp, contentManager ); registry.AssignComponent( entity, sprite ); } }
public static void Run( Ecs.Registry ecsRegistry, SpriteBatch spriteBatch, Camera camera ) { HashSet <Ecs.Entity> entities = ecsRegistry.GetEntities( typeof(SpriteComp), typeof(PositionComp) ); foreach (Ecs.Entity entity in entities) { SpriteComp spriteComp = ecsRegistry .GetComponentUnsafe <SpriteComp>(entity); PositionComp positionComp = ecsRegistry .GetComponentUnsafe <PositionComp>(entity); if (camera.IsInRange(positionComp.data)) { Render(spriteComp, positionComp, spriteBatch, camera); } } }
public static void Run( Ecs.Registry registry, ContentManager contentManager ) { HashSet <Ecs.Entity> entities = registry.GetEntities( typeof(Comps.Character), typeof(Comps.Orientations.Cardinal) ); foreach (Ecs.Entity entity in entities) { var characterComp = registry .GetComponentUnsafe <Comps.Character>(entity); var orientationComp = registry .GetComponentUnsafe <Comps.Orientations.Cardinal>(entity); CompsExt.Visibles.Sprite sprite = CreateVisibleComp( characterComp, orientationComp, contentManager ); registry.AssignComponent( entity, sprite ); } }
public static void Run( Ecs.Registry registry, ContentManager contentManager ) { HashSet <Ecs.Entity> entities = registry.GetEntities( typeof(Comps.Projectile), typeof(Comps.Orientations.Cardinal) ); foreach (Ecs.Entity entity in entities) { var projectileComp = registry .GetComponentUnsafe <Comps.Projectile>(entity); if (!IsVisible(projectileComp.kind)) { continue; } var orientationComp = registry .GetComponentUnsafe <Comps.Orientations.Cardinal>(entity); CompsExt.Visibles.Sprite sprite = CreateVisibleComp( projectileComp, orientationComp, contentManager ); registry.AssignComponent( entity, sprite ); } }