public SpriteRenderSystem()
     : base(
         Aspect.All(
             typeof(SpriteComponent),
             typeof(PositionComponent)))
 {
 }
示例#2
0
 public PlayerShipControlSystem(EntityFactory entityFactory)
     : base(Aspect.All(typeof(PlayerComponent), typeof(Transform2)))
 {
     _entityFactory      = entityFactory;
     _missileLaunchDelay = TimeSpan.FromMilliseconds(250);
     _missileLaunchTimer = TimeSpan.Zero;
 }
示例#3
0
 public PlayerStateSystem(IInputManager inputManager,
                          EntityWorld world)
     : base(Aspect.All(typeof(PlayerStateMap)))
 {
     _inputManager = inputManager;
     _world        = world;
 }
示例#4
0
 public SpriteSystem()
     : base(
         Aspect.All(
             typeof(SpriteComponent),
             typeof(ContentManagerComponent)))
 {
 }
 public PlayerInputSystem()
     : base(
         Aspect.All(
             typeof(PlayerInputComponent),
             typeof(InputIntentComponent)))
 {
 }
示例#6
0
        public Entity FindNearest(Entity thing, ThingType thingType)
        {
            Entity foundThing = null;
            float  bestDist   = 99999999f;
            var    b          = thing.entityWorld.EntityManager.GetEntities(Aspect.All(typeof(ThingComp)));

            foreach (Entity e in b)
            {
                var tc = e.GetComponent <ThingComp>();
                if (tc == this)
                {
                    continue;
                }
                if (!tc.Active)
                {
                    continue;
                }
                if (tc.Type == thingType)
                {
                    float dist = (tc.Position - this.Position).Length();
                    if (dist < bestDist)
                    {
                        bestDist   = dist;
                        foundThing = e;
                    }
                }
            }
            return(foundThing);
        }
示例#7
0
 public ArmDrawingSystem(SpriteBatch spriteBatch, Texture2D armTexture, Texture2D jointTexture)
     : base(Aspect.All(typeof(HandComponent), typeof(PositionComponent)))
 {
     _spriteBatch  = spriteBatch;
     _armTexture   = armTexture;
     _jointTexture = jointTexture;
 }
示例#8
0
 public RenderSystem(GraphicsDevice graphicsDevice, Camera camera)
     : base(Aspect.All(typeof(Sprite), typeof(Transform2)))
 {
     _graphicsDevice = graphicsDevice;
     _camera         = camera;
     _spriteBatch    = new SpriteBatch(graphicsDevice);
 }
示例#9
0
 public SpeedSystem()
     : base(
         Aspect.All(
             typeof(PositionComponent),
             typeof(SpeedComponent)))
 {
 }
 public RendererSystem(GameApp gameApp) : base(Aspect
                                               .All(typeof(RenderFormComponent), typeof(Transform2D)))
 {
     _gameApp = gameApp;
     _sb      = new SpriteBatch(_gameApp.GraphicsDevice);
     _camera  = gameApp.Services.GetService <OrthographicCamera>();
 }
示例#11
0
 public GoalSpeedSystem()
     : base(
         Aspect.All(
             typeof(SpeedComponent),
             typeof(GoalSpeedComponent)))
 {
 }
 public RenderCollisionBoxSystem(SpriteBatch spriteBatch) :
     base(Aspect.All(typeof(CollisionBox),
                     typeof(Position),
                     typeof(Renderable)))
 {
     _spriteBatch = spriteBatch;
 }
示例#13
0
 public HudRenderSystem(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, BitmapFont font)
     : base(Aspect.All(typeof(PlayerComponent), typeof(HealthComponent)))
 {
     _graphicsDevice = graphicsDevice;
     _spriteBatch    = spriteBatch;
     _font           = font;
 }
示例#14
0
 public EntityCollisionSystem(IScriptManager scriptManager)
     : base(Aspect.All(typeof(Position),
                       typeof(CollisionBox),
                       typeof(Script)))
 {
     _scriptManager = scriptManager;
 }
 public SpriteBinaryDirectionSystem()
     : base(
         Aspect.All(
             typeof(BinaryDirectionComponent),
             typeof(SpriteComponent)))
 {
 }
示例#16
0
        public void TestAspectAllMultiple()
        {
            Aspect      aspect      = Aspect.All(typeof(TestHealthComponent), typeof(TestPowerComponent));
            EntityWorld entityWorld = new EntityWorld();
            Entity      entity;

            entity = entityWorld.CreateEntity();
            Assert.IsFalse(aspect.Interests(entity), "Entity without components must NOT be subject to \"Healthy Powered\" Aspect");

            entity = entityWorld.CreateEntity();
            entity.AddComponent(new TestHealthComponent());
            Assert.IsFalse(aspect.Interests(entity), "Entity with {TestHealthComponent} must NOT be subject to \"Healthy Powered\" Aspect");

            entity = entityWorld.CreateEntity();
            entity.AddComponent(new TestHealthComponent());
            entity.AddComponent(new TestPowerComponentPoolable());
            Assert.IsFalse(aspect.Interests(entity), "Entity with {TestHealthComponent, TestPowerComponentPoolable} must NOT be subject to \"Healthy Powered\" Aspect");

            entity = entityWorld.CreateEntity();
            entity.AddComponent(new TestHealthComponent());
            entity.AddComponent(new TestPowerComponent());
            Assert.IsTrue(aspect.Interests(entity), "Entity with {TestHealthComponent, TestPowerComponent} must be subject to \"Healthy Powered\" Aspect");

            entity = entityWorld.CreateEntity();
            entity.AddComponent(new TestHealthComponent());
            entity.AddComponent(new TestPowerComponent());
            entity.AddComponent(new TestPowerComponentPoolable());
            Assert.IsTrue(aspect.Interests(entity), "Entity with {TestHealthComponent, TestPowerComponent, TestPowerComponentPoolable} must be subject to \"Healthy Powered\" Aspect");
        }
示例#17
0
        public GUISystem(GraphicsDevice graphicsDevice)
            : base(Aspect
                   .All(typeof(Transform2D), typeof(GUIStyle)))

        {
            _graphicsDevice = graphicsDevice;
            _sb             = new SpriteBatch(_graphicsDevice);
        }
示例#18
0
 /// <summary>Initializes a new instance of the <see cref="EntitySystem" /> class.</summary>
 /// <param name="types">The types.</param>
 protected EntitySystem(params Type[] types)
     : this()
 {
     Debug.Assert(types != null, "Types must not be null.");
     Debug.Assert(types.Length != 0, "Types must not be zero lengthed.");
     this.Aspect = Aspect.All(types);
     this.Types  = types;
 }
示例#19
0
 public RenderTextSystem(SpriteBatch spriteBatch,
                         IContentManager contentManager)
     : base(Aspect.All(typeof(VisibleText),
                       typeof(Position)))
 {
     _spriteBatch    = spriteBatch;
     _contentManager = contentManager;
 }
示例#20
0
 public GridSystem(GraphicsDevice graphicsDevice, Camera camera, Texture2D grassTexture)
     : base(Aspect.All(typeof(Hex), typeof(Sprite), typeof(Transform2)))
 {
     _graphicsDevice = graphicsDevice;
     _camera         = camera;
     _grassTexture   = grassTexture;
     _spriteBatch    = new SpriteBatch(graphicsDevice);
 }
示例#21
0
        public InteractionSystem(ViewportAdapter viewportAdapter = null) : base(Aspect
                                                                                .All(typeof(Interaction2DComponent), typeof(Transform2DComponent)))
        {
            _viewportAdapter = viewportAdapter;

            current_pressedButtons = Array.Empty <MouseButtons>();
            prev_pressedButtons    = Array.Empty <MouseButtons>();
        }
示例#22
0
 /// <inheritdoc />
 public HeartbeatSystem(EntityWorld world,
                        IScriptService scriptService)
     : base(Aspect.All(typeof(Heartbeat),
                       typeof(ScriptGroup)))
 {
     _world         = world;
     _scriptService = scriptService;
 }
示例#23
0
 public HeartbeatSystem(IScriptManager scriptManager,
                        EntityWorld world)
     : base(Aspect.All(typeof(Heartbeat),
                       typeof(Script)))
 {
     _scriptManager = scriptManager;
     _world         = world;
 }
示例#24
0
 public SpriteSystem(EntityWorld world)
     : base(Aspect.All(
                typeof(Sprite),
                typeof(Renderable),
                typeof(Position)))
 {
     _world = world;
 }
示例#25
0
        public RenderHudSystem(GameApp gameApp) : base(Aspect
                                                       .All(typeof(TagHUDComponent), typeof(RenderFormComponent)))
        {
            _gameApp = gameApp;
            _sb      = new SpriteBatch(_gameApp.GraphicsDevice);

            _viewportAdapter = new ScalingViewportAdapter(_gameApp.GraphicsDevice, GameApp.DefaultWidth, GameApp.DefaultHeight);
        }
示例#26
0
        public IndicatorDrawSystem(SpriteBatch spriteBatch, ContentManager content)
            : base(Aspect.All(typeof(PositionComponent), typeof(IndicatorComponent)))
        {
            this.spriteBatch = spriteBatch;

            // Load content.
            cardAttributeFont = content.Load <SpriteFont>("Fonts/card_attribute_font");
        }
 public MapCollisionSystem()
     : base(
         Aspect.All(
             typeof(PositionComponent),
             typeof(SpeedComponent),
             typeof(AABBComponent)))
 {
 }
示例#28
0
 public RenderSystem(SpriteBatch spriteBatch, OrthographicCamera camera, ContentManager content)
     : base(Aspect.All(typeof(Transform2)).One(typeof(AnimatedSprite), typeof(Sprite)).Exclude(typeof(Tile), typeof(DotPlayer)))
 {
     this.spriteBatch = spriteBatch;
     this.camera      = camera;
     this.content     = content;
     damageEffect     = content.Load <Effect>("Effects/damage_effect");
 }
示例#29
0
 public LevelCollisionSystem(EntityWorld world,
                             IInputManager input) :
     base(Aspect.All(typeof(CollisionBox),
                     typeof(Position),
                     typeof(Velocity)))
 {
     _world = world;
     _input = input;
 }
示例#30
0
        public void IsInterestedInAllComponents()
        {
            var allAspect = Aspect
                            .All(typeof(Sprite), typeof(Transform2), typeof(DummyComponent))
                            .Build(_componentManager);

            Assert.True(allAspect.IsInterested(_entityA));
            Assert.False(allAspect.IsInterested(_entityB));
        }