private void InitializeSystems(World world, out ISystem <float> systems)
        {
            var _runner = new DefaultParallelRunner(Environment.ProcessorCount);

            systems = new SequentialSystem <float>(
                new CounterSystem(world),
                new TimerSystem(world),
                new GenerationSystem(world, _cellPool, _gameState),
                new SelectSystem(world, _game.Window, _gameState),
                new SwapSystem(world),
                new CancelSwapSystem(world),
                new SwapFinishedSystem(world),
                new FindMatchesSystem(world, _gameState),
                new CombinationSystem(world, _gameState),
                new DestroyersSystem(world, _gameState),
                new LineBonusSystem(world),
                new BombSystem(world),
                new FallSystem(world, _gameState),
                new TargetPositionSystem(world),
                new WaitFallingSystem(world, _gameState),
                new RotationSystem(world),
                new TransformSystem(world, _runner),
                new FrameAnimationUpdateSystem(world),
                new SpriteRenderSystem(_batch, _backgroundLayer),
                new FrameAnimationDrawSystem(_batch, world),
                new SpriteRenderSystem(_batch, _cellsLayer),
                new SpriteRenderSystem(_batch, _destroyersLayer),
                new SpriteRenderSystem(_batch, _borderLayer),
                new TextRenderSystem(_batch, world),
                new DestroyersDyingSystem(world),
                new DyingSystem(world, _gameState),
                new DelayedDyingSystem(world)
                );
        }
Exemple #2
0
        private void InitializeSystems(World world, out ISystem <float> systems)
        {
            var _runner = new DefaultParallelRunner(Environment.ProcessorCount);

            systems = new SequentialSystem <float>(
                new SpriteRenderSystem(_batch, world.GetEntities().With <SpriteRenderer>().AsSet()),
                new TransformSystem(world, _runner),
                new ButtonSystem(world, _game.Window)
                );
        }
Exemple #3
0
 public Scene(World world,
              ISystem <float>[] updateSystems,
              ISystem <SpriteBatchState>[] drawSystems,
              ISystem <SpriteBatchState>[] guiSystems)
 {
     World   = world;
     _update = new SequentialSystem <float>(updateSystems);
     _draw   = new SequentialSystem <SpriteBatchState>(drawSystems);
     _gui    = new SequentialSystem <SpriteBatchState>(guiSystems);
     Camera  = new OrthographicCamera(SceneManager.ViewportAdapter);
 }
Exemple #4
0
        public Game()
        {
            _world = new World();
            _world.SetEntityMutator(new GGJ2020EntityMutator());
            var container = Container.Instance;

            container.Register(typeof(World), () => _world).AsSingleton();
            _initSystem    = MakeInitializeSystem(_world);
            _runtimeSystem = MakeRuntimeSystem(_world);
            _cleanupSystem = MakeCleanupSystem(_world);
        }
Exemple #5
0
 public Scene(World world,
              ISystem <float>[] updateSystems,
              ISystem <SpriteBatchState>[] drawSystems,
              ISystem <SpriteBatchState>[] guiSystems,
              Camera <Vector2> camera)
 {
     World   = world;
     _update = new SequentialSystem <float>(updateSystems);
     _draw   = new SequentialSystem <SpriteBatchState>(drawSystems);
     _gui    = new SequentialSystem <SpriteBatchState>(guiSystems);
     Camera  = camera;
 }
        public void Update_Should_call_update_on_all_systems()
        {
            bool done1 = false;
            bool done2 = false;

            using (ISystem <int> system = new SequentialSystem <int>(
                       new ActionSystem <int>(_ => done1 = true),
                       new ActionSystem <int>(_ => done2 = true)))
            {
                system.Update(0);
            }

            Check.That(done1).IsTrue();
            Check.That(done2).IsTrue();
        }
        public void Update_Should_not_call_update_on_any_systems_When_disabled()
        {
            bool done1 = false;
            bool done2 = false;

            using (ISystem <int> system = new SequentialSystem <int>(
                       new ActionSystem <int>(_ => done1 = true),
                       new ActionSystem <int>(_ => done2 = true)))
            {
                system.IsEnabled = false;
                system.Update(0);
            }

            Check.That(done1).IsFalse();
            Check.That(done2).IsFalse();
        }
        public void Dispose_Should_call_Dispose_on_all_systems()
        {
            bool done1 = false;
            bool done2 = false;

            ISystem <int> s1 = Substitute.For <ISystem <int> >();
            ISystem <int> s2 = Substitute.For <ISystem <int> >();

            s1.When(s => s.Dispose()).Do(_ => done1 = true);
            s2.When(s => s.Dispose()).Do(_ => done2 = true);

            ISystem <int> system = new SequentialSystem <int>(s1, s2);

            system.Dispose();

            Check.That(done1).IsTrue();
            Check.That(done2).IsTrue();
        }