Ejemplo n.º 1
0
        public override Systems CreateUpdateSystems(IContexts contexts1)
        {
            var contexts          = contexts1 as Contexts;
            var sessionObjects    = contexts.session.commonSession;
            var entityIdGenerator = sessionObjects.EntityIdGenerator;


            _gameModule = new CompositeGameModule();

            _gameModule.AddModule(new ServerPlayerModule(contexts));
            _gameModule.AddModule(new ServerEntityInitModule(contexts));
            _gameModule.AddModule(new ServerBulletModule(contexts));

            IHitBoxEntityManager hitBoxEntityManager = new HitBoxEntityManager(contexts, true);
            var snapshotSelectorContainer            = contexts.session.serverSessionObjects.CompensationSnapshotSelector;
            ICompensationWorldFactory factory        =
                new ServerCompensationWorldFactory(snapshotSelectorContainer, hitBoxEntityManager);
            var serverDamageInfoCollector = new ServerDamageInfoCollector(contexts.player);

            _gameModule.AddModule(new UserCmdGameModule(contexts,
                                                        factory,
                                                        new BulletHitHandler(contexts,
                                                                             entityIdGenerator,
                                                                             room.PlayerDamager,
                                                                             serverDamageInfoCollector,
                                                                             contexts.session.entityFactoryObject.SoundEntityFactory,
                                                                             SingletonManager.Get <EnvironmentTypeConfigManager>()),
                                                        new MeleeHitHandler(contexts, room.PlayerDamager, entityIdGenerator,
                                                                            serverDamageInfoCollector, contexts.session.entityFactoryObject.SoundEntityFactory),
                                                        new ThrowingHitHandler(contexts, room.PlayerDamager),
                                                        sessionObjects,
                                                        MotorsFactory.CraeteMotors(contexts, SingletonManager.Get <CameraConfigManager>().Config)));
            _gameModule.AddModule(new ServerPostPredictionModule(contexts));
            _gameModule.AddModule(new ServerVehicleModule(contexts,
                                                          contexts.session.serverSessionObjects.VehicleTimer));
            _gameModule.AddModule(new ServerGamePlayModule(contexts, room));
            _gameModule.AddModule(
                new ServerSceneObjectModule(contexts, this, sessionObjects.EquipmentEntityIdGenerator));

            IUserCmdExecuteSystemHandler    userCmdExecuteSystemHandler    = new UserCmdExecuteSystemHandler(contexts);
            IVehicleCmdExecuteSystemHandler vehicleCmdExecuteSystemHandler =
                new ServerVehicleCmdExecuteSystemHandler(contexts);

            var systems = new Feature("GameSessionState");

            systems.Add(new PingSystem(contexts));
            systems.Add(new ServerMainFeature(
                            "ServerSystems",
                            _gameModule,
                            userCmdExecuteSystemHandler,
                            vehicleCmdExecuteSystemHandler,
                            contexts.session.serverSessionObjects.SimulationTimer,
                            new VehicleExecutionSelector(contexts),
                            sessionObjects,
                            room));

            return(systems);
        }
        public override Systems CreateUpdateSystems(IContexts contexts1)
        {
            var contexts          = contexts1 as Contexts;
            var sessionObjects    = contexts.session.commonSession;
            var entityIdGenerator = sessionObjects.EntityIdGenerator;


            _gameModule = new CompositeGameModule();

            _gameModule.AddModule(new ServerPlayerModule(contexts));
            //if (GameRules.IsChicken(contexts.session.commonSession.RoomInfo.ModeId))
            //{
            _gameModule.AddModule(new ServerEntityInitModule(contexts));
            //}

            IHitBoxEntityManager hitBoxEntityManager = new HitBoxEntityManager(contexts, true);
            var SnapshotSelector =
                contexts.session.serverSessionObjects.SnapshotSelector;
            ICompensationWorldFactory factory =
                new ServerCompensationWorldFactory(SnapshotSelector, hitBoxEntityManager);

            _gameModule.AddModule(new UserCmdGameModule(contexts, factory,
                                                        new BulletHitHandler(contexts, entityIdGenerator, room.PlayerDamager),
                                                        new MeleeHitHandler(room.PlayerDamager),
                                                        new ThrowingHitHandler(room.PlayerDamager), sessionObjects,
                                                        MotorsFactory.CraeteMotors(contexts, SingletonManager.Get <CameraConfigManager>().Config)));
            _gameModule.AddModule(new ServerPostPredictionModule(contexts));
            _gameModule.AddModule(new ServerVehicleModule(contexts,
                                                          contexts.session.serverSessionObjects.VehicleTimer));
            _gameModule.AddModule(new ServerGamePlayModule(contexts, room));
            _gameModule.AddModule(
                new ServerSceneObjectModule(contexts, this, sessionObjects.EquipmentEntityIdGenerator));

            IServerUserCmdList serrverServerUserCmdList = new ServerServerUserCmdList(contexts);
            IVehicleCmdExecuteSystemHandler vehicleCmdExecuteSystemHandler =
                new ServerVehicleCmdExecuteSystemHandler(contexts);

            var systems = new Feature("GameSessionState");

            systems.Add(new PingSystem(contexts));
            systems.Add(new ServerMainFeature("ServerSystems", _gameModule, serrverServerUserCmdList,
                                              vehicleCmdExecuteSystemHandler, contexts.session.serverSessionObjects.SimulationTimer,
                                              new VehicleExecutionSelector(contexts), sessionObjects, room));

            return(systems);
        }