Beispiel #1
0
        private void OnEnable()
        {
            _ecsWorld  = new EcsWorld();
            _systems   = new EcsSystems(_ecsWorld);
            _gameState = new GameState();

            _tilesPool = gameObject.GetComponentInChildren <TilesPool>();
            _tilesPool.Prewarm(20, configuration.tileView);

            _audioSource = GetComponent <AudioSource>();

#if UNITY_EDITOR
            Leopotam.Ecs.UnityIntegration.EcsWorldObserver.Create(_ecsWorld);
            Leopotam.Ecs.UnityIntegration.EcsSystemsObserver.Create(_systems);
#endif

            _systems
            .Add(new TempoEmitSystem())
            .Add(new TempoTileSpawnerSystem())
            .Add(new TempoTilesMoveSystem())
            .Add(new TempoHitSystem())

            .Inject(_gameState)
            .Inject(configuration)
            .Inject(_tilesPool)
            .Inject(_audioSource)

            .OneFrame <TempoEvent>()
            .OneFrame <TempoHitEvent>()

            .Init();
        }
Beispiel #2
0
 public BlockFactory(TilesPool tilesPool, Block.Factory factory)
 {
     _tilesPool = tilesPool;
     _factory   = factory;
 }