示例#1
0
 public BulletHitSimulator(int hitboxLayerMask, ICompensationWorldFactory compensationWorldCreator,
                           IBulletHitHandler bulletHitHandler, int moveInterval)
 {
     _hitboxLayerMask          = hitboxLayerMask;
     _compensationWorldCreator = compensationWorldCreator;
     _bulletHitHandler         = bulletHitHandler.SetHitLayerMask(_hitboxLayerMask);
     _moveSimulator            = new BulletMoveSimulator(moveInterval);
 }
示例#2
0
 public MeleeAttackSystem(
     Contexts contexts,
     ICompensationWorldFactory compensationWorld,
     MeleeHitHandler hitHandler)
 {
     _contexts = contexts;
     _compensationWorldFactory = compensationWorld;
     this.hitHandler           = hitHandler;
 }
        public BulletSimulationSystem(Contexts contexts, ICompensationWorldFactory compensationWorldFactory,
                                      IBulletHitHandler bulletHitHandler)
        {
            _bulletEntityCollector = new BulletEntityCollector(contexts.bullet, contexts.player);
            int layerMask = BulletLayers.GetBulletLayerMask();

            _bulletSimulator = new BulletHitSimulator(layerMask, compensationWorldFactory, bulletHitHandler,
                                                      SharedConfig.BulletSimulationIntervalTime);
        }
示例#4
0
 public MeleeAttackSystem(
     Contexts contexts,
     ICompensationWorldFactory compensationWorld,
     IMeleeHitHandler hitHandler)
 {
     _contexts  = contexts;
     _attackers = contexts.player.GetGroup(PlayerMatcher.MeleeAttackInfoSync);
     _compensationWorldFactory = compensationWorld;
     _meleeHitHandler          = hitHandler;
 }
 public ThrowingSimulationSystem(
     Contexts contexts,
     ICompensationWorldFactory compensationWorldFactory,
     ThrowingHitHandler hitHandler)
 {
     _contexts                 = contexts;
     _layerMask                = UnityLayers.SceneCollidableLayerMask | UnityLayerManager.GetLayerIndex(EUnityLayerName.UI);//BulletLayers.GetBulletLayer();
     _moveSimulator            = new ThrowingMoveSimulator(20, contexts.player);
     _compensationWorldFactory = compensationWorldFactory;
     _throwingHitHandler       = hitHandler;
     //all throwings
     _throwings = _contexts.throwing.GetGroup(ThrowingMatcher.AllOf(ThrowingMatcher.ThrowingData));
     //all vehicles
     _vehicles = _contexts.vehicle.GetGroup(VehicleMatcher.AllOf(VehicleMatcher.GameObject));
     //all players
     _players = _contexts.player.GetGroup(PlayerMatcher.AllOf(PlayerMatcher.FirstPersonModel, PlayerMatcher.ThirdPersonModel));
 }
示例#6
0
        public UserCmdGameModule(Contexts contexts,
                                 ICompensationWorldFactory compensationWorldFactory,
                                 IBulletHitHandler bulletHitHandler,
                                 IMeleeHitHandler meleeHitHandler,
                                 IThrowingHitHandler throwingHitHandler,
                                 ICommonSessionObjects commonSessionObjects,
                                 Motors motors)
        {
            if (SharedConfig.IsServer)
            {
                AddSystem(new PlayerSyncStageSystem(contexts));
            }
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerSynchronizeFromComponentSystem());
            }
            else
            {
                AddSystem(new ServerSynchronizeFromComponentSystem());
            }
            AddSystem(new PlayerClientTimeSystem());
            AddSystem(new PlayerGrenadeInventorySyncSystem());
            //AddSystem(new CameraUpdateArchorSystem(contexts));
            AddSystem(new PlayerRotateLimitSystem());
            AddSystem(new CameraPreUpdateSystem(contexts, motors));
            AddSystem(new BulletSimulationSystem(contexts, compensationWorldFactory, bulletHitHandler));
            AddSystem(new PlayerAttackSystem(contexts));
            AddSystem(new MeleeAttackSystem(contexts, compensationWorldFactory, meleeHitHandler));
            AddSystem(new ThrowingSimulationSystem(contexts, compensationWorldFactory, throwingHitHandler, contexts.session.entityFactoryObject.SoundEntityFactory));
            AddSystem(new PlayerBulletGenerateSystem(contexts));

            AddSystem(new PlayerWeaponSwitchSystem(contexts));
            AddSystem(new PlayerWeaponDrawSystem(contexts));
            AddSystem(new PlayerWeapnStateUpdateSystem(contexts));

            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerSkyMoveStateUpdateSystem(contexts));
            }
            else
            {
                AddSystem(new ServerPlayerSkyMoveStateUpdateSystem(contexts));
            }

//            AddSystem(new PlayerMoveByRootMotionSystem());

            AddSystem(new CreatePlayerLifeStateDataSystem());

            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerMoveSystem(contexts));
            }
            else
            {
                AddSystem(new ServerMoveSystem(contexts));
            }

            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerSpecialZoneEventSystem(contexts));
            }
            else
            {
                AddSystem(new ServerSpecialZoneEventSystem(contexts));
            }
            AddSystem(new PlayerControlledVehicleUserCmdExecuteSystem());
            AddSystem(new UpdatePlayerPositionOnVehicle(contexts));
            //AddSystem(new PlayerCameraInputSystem(contexts.player));
            AddSystem(new VehicleRideSystem(contexts));
            if (!SharedConfig.IsServer)
            {
                AddSystem(new VehicleCameraUpdateSystem(contexts));
            }
            AddSystem(new PlayerOxygenEnergySystem(contexts.vehicle));
            AddSystem(new PlayerCustomInputUpdateSystem());


            AddSystem(new PlayerAutoMoveSystem());
            AddSystem(new PlayerClimbActionSystem());
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerStateUpdateSystem(contexts));
            }
            else
            {
                AddSystem(new PlayerServerStateUpdateSystem(contexts));
            }

            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerMoveByRootMotionSystem());
            }
            else
            {
                AddSystem(new ServerMoveByRootMotionSystem());
            }
            AddSystem(new PlayerFirstAppearanceUpdateSystem());
            AddSystem(new PlayerAppearanceUpdateSystem());
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerCharacterBoneUpdateSystem());
            }
            else
            {
                AddSystem(new ServerCharacterBoneUpdateSystem());
            }
            AddSystem(new PlayerHoldBreathSystem());
            AddSystem(new PlayerAvatarSystem());
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerSynchronizeToComponentSystem());
            }

            AddSystem(new PlayerBuffUpdateSystem(contexts));
            AddSystem(new PlayerFallDamageSystem(contexts));
            AddSystem(new PlayerSaveSystem(contexts));
            AddSystem(new PlayerStatisticsSystem());
            AddSystem(new CameraUpdateArchorSystem(contexts));
            if (!SharedConfig.IsServer)
            {
                AddSystem(new CameraUpdateSystem(contexts, motors));
            }
            else
            {
                AddSystem(new ServerCameraUpdateSystem(contexts, motors));
            }
            AddSystem(new PlayerStateTipSystem(contexts));

            AddSystem(new PlayerActionInterruptSystem());
            AddSystem(new PlayerBagSwitchSystem(commonSessionObjects));
            if (!SharedConfig.IsServer)
            {
                AddSystem(new CameraPostUpdateSystem(contexts.player, contexts.vehicle, contexts.freeMove));
            }
            else
            {
                AddSystem(new ServerPostCameraUpdateSystem(contexts));
            }
            AddSystem(new PlayerSoundPlaySystem(contexts));
        }
示例#7
0
        public UserCmdGameModule(Contexts contexts, ICompensationWorldFactory compensationWorldFactory, IBulletHitHandler bulletHitHandler,
                                 MeleeHitHandler meleeHitHandler, ThrowingHitHandler throwingHitHandler, ICommonSessionObjects commonSessionObjects, Motors motors)
        {
            if (!SharedConfig.IsServer)
            {
                AddSystem(new ClientPlayerPreSyncDataSystem());
            }

            AddSystem(new PlayerStatisticsUpdateSystem());
            AddSystem(new PlayerWeaponCmdUpdateSystem());
            AddSystem(new PlayerInterruptUpdateSystem());
            if (SharedConfig.IsServer)
            {
                AddSystem(new PlayerSyncStageSystem(contexts));
            }
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerSynchronizeFromComponentSystem());
            }
            else
            {
                AddSystem(new ServerSynchronizeFromComponentSystem());
            }
            AddSystem(new PlayerClientTimeSystem());
            AddSystem(new PlayerRotateLimitSystem());

            AddSystem(new CameraPreUpdateSystem(contexts, motors));
            if (!SharedConfig.IsServer)
            {
                AddSystem(new ClientPrepareObserveSystem(contexts));
            }

            AddSystem(new CameraFireInfoSyncSystem(contexts));

            AddSystem(new BulletSimulationSystem(contexts, compensationWorldFactory, bulletHitHandler));
            AddSystem(new PlayerWeaponSwitchSystem());
            AddSystem(new PlayerWeaponDrawSystem());

            AddSystem(new PlayerAttackSystem(contexts));
            AddSystem(new MeleeAttackSystem(contexts, compensationWorldFactory, meleeHitHandler));
            AddSystem(new ThrowingSimulationSystem(contexts, compensationWorldFactory, throwingHitHandler));
            AddSystem(new PlayerBulletGenerateSystem(contexts));


            AddSystem(new PlayerWeaponGamePlayUpdateSystem(contexts));
            AddSystem(new PlayerAudioCmdUpdateSystem());
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerSkyMoveStateUpdateSystem(contexts));
            }
            else
            {
                AddSystem(new ServerPlayerSkyMoveStateUpdateSystem(contexts));
            }

            AddSystem(new CreatePlayerLifeStateDataSystem());

            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerMoveSystem(contexts));
            }
            else
            {
                AddSystem(new ServerMoveSystem(contexts));
            }

            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerSpecialZoneEventSystem(contexts));
            }
            else
            {
                AddSystem(new ServerSpecialZoneEventSystem(contexts));
            }
            AddSystem(new PlayerControlledVehicleUserCmdExecuteSystem());
            AddSystem(new UpdatePlayerPositionOnVehicle(contexts));
            AddSystem(new VehicleRideSystem(contexts));
            if (!SharedConfig.IsServer)
            {
                AddSystem(new VehicleCameraUpdateSystem(contexts));
            }
            AddSystem(new PlayerOxygenEnergySystem(contexts.vehicle));
            AddSystem(new PlayerCustomInputUpdateSystem());


            AddSystem(new PlayerAutoMoveSystem());
            AddSystem(new PlayerClimbActionSystem());
            AddSystem(new PlayerLadderActionSystem());
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerStateUpdateSystem(contexts));
            }
            else
            {
                AddSystem(new PlayerServerStateUpdateSystem(contexts));
            }

            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerMoveByRootMotionSystem());
            }
            else
            {
                AddSystem(new ServerMoveByRootMotionSystem());
            }
            AddSystem(new PlayerFirstAppearanceUpdateSystem());
            AddSystem(new PlayerAppearanceUpdateSystem());
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerCharacterBoneUpdateSystem());
            }
            else
            {
                AddSystem(new ServerCharacterBoneUpdateSystem());
            }
            AddSystem(new PlayerDeadAnimSystem());
            AddSystem(new PlayerHoldBreathSystem());
            AddSystem(new PlayerAvatarSystem());

            AddSystem(new PlayerAppearanceDebugSystem(contexts.player));

            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerSynchronizeToComponentSystem());
            }

            AddSystem(new PlayerBuffUpdateSystem(contexts));
            AddSystem(new PlayerFallDamageSystem(contexts));
            AddSystem(new PlayerSaveSystem(contexts));
            AddSystem(new PlayerStatisticsSystem());
            AddSystem(new CameraUpdateArchorSystem(contexts));
            if (!SharedConfig.IsServer)
            {
                AddSystem(new CameraUpdateSystem(contexts, motors));
            }
            else
            {
                AddSystem(new ServerCameraUpdateSystem(contexts, motors));
            }
            AddSystem(new PlayerStateTipSystem(contexts));

            AddSystem(new PlayerBagSwitchSystem(commonSessionObjects, contexts));
            if (!SharedConfig.IsServer)
            {
                AddSystem(new CameraPostUpdateSystem(contexts));
            }
            else
            {
                AddSystem(new ServerPostCameraUpdateSystem(contexts));
            }
            if (!SharedConfig.IsServer)
            {
                AddSystem(new PlayerBioSwitchSystem(contexts));
                AddSystem(new PlayerWitnessSystem(contexts));
            }
        }