Exemple #1
0
 protected virtual List <KeyValuePair <MapCoordinate, Stairs> > GetStairs(IMap map, StairDirection direction, IEntityEngine engine)
 {
     return(engine.EntitiesWith <Stairs>()
            .Where(e => e.Get <Position>().MapCoordinate.Key == map.MapKey)
            .Where(c => c.Get <Stairs>().Direction == direction)
            .Select(c => new KeyValuePair <MapCoordinate, Stairs>(c.Get <Position>().MapCoordinate, c.Get <Stairs>()))
            .ToList());
 }
Exemple #2
0
        public void EntitiesWith_ReturnsEntitiesWithComponent()
        {
            var testEntity1 = engine.New("testEntity1", new Appearance());
            var testEntity2 = engine.New("testEntity2");
            var testEntity3 = engine.New("testEntity3", new Appearance(), new Prototype());

            var result = engine.EntitiesWith <Appearance>();

            result.Select(e => e.Name).Should().BeEquivalentTo(new List <string> {
                "testEntity1"
            });

            result = engine.EntitiesWith <Appearance>(includePrototypes: true);

            result.Select(e => e.Name).Should().BeEquivalentTo(new List <string> {
                "testEntity1", "testEntity3"
            });
        }