Ejemplo n.º 1
0
        public void Start()
        {
            var services = CreateAllSharedState(_options);
            var worldCfg = new EcsWorldConfig()
            {
                ComponentsCount = _options.EntitiesMax,
                EntitiesCount   = _options.EntitiesMax,
            };

            _worlds = new EcsWorlds(services);
            _world  = _worlds.Create(cfg: worldCfg);
            _world
            .Register <Actor>()
            .Register <Bullet>()
            .Register <Deleted>()
            .Register <DesiredVelocity>()
            .Register <Position>()
            .Register <Rotation>()
            .Register <Weapon>()
            ;

            _systems = new EcsSystems();
            _systems
            .Add(new InitSystem())
            .Add(new TimeSystem())
            .Add(new ShootSystem())
            .Add(new BulletSystem())
            .Add(new MoveSystem())
            ;

            AddActorTypeSystemsByTypeCount();

            if (_options.IsRendering)
            {
                _systems
                .Add(new ActorViewUpdateSystem())
                .Add(new BulletViewDeleteSystem())
                .Add(new BulletViewUpdateSystem())
                ;
            }

            _systems.Add(new BulletDeleteSystem());

            _worlds.Init();
            _systems.Init(_worlds);
            _world = null;
        }
        public void Start()
        {
            var lss = new LocalSharedState();

            lss.Count = _options.ComponentsCount;

            var worldCfg = new EcsWorldConfig()
            {
                ComponentsCount = lss.Count,
                EntitiesCount   = lss.Count,
            };

            _worlds = new EcsWorlds(lss);
            _worlds
            .Create(cfg: worldCfg)
            .Register <Movable>();

            _worlds.Init();
            _systems = new EcsSystems();
            _systems
            .Add(new MoveSystem())
            .Init(_worlds)
            ;
        }