Exemple #1
0
 public PickupDropHandlerAdapter(Contexts context, int modelId)
 {
     sceneObjectEntityFactory = context.session.entityFactoryObject.SceneObjectEntityFactory;
     commonSession            = context.session.commonSession;
     runtimeGameConfig        = context.session.commonSession.RuntimeGameConfig;
     sceneWeaponLifeTime      = SingletonManager.Get <GameModeConfigManager>().GetWepaonStayTime(modelId);
 }
 public ServerFracturedChunkDetachCallback(Contexts contexts)
 {
     _sceneObjectContext       = contexts.sceneObject;
     _sceneObjectEntityFactory = contexts.session.entityFactoryObject.SceneObjectEntityFactory;
     _currentTime           = contexts.session.currentTimeObject;
     MapObjectEntityFactory = contexts.session.entityFactoryObject.MapObjectEntityFactory;
 }
        public static void ProcessMapObjectCommand(DebugCommand message, MapObjectContext context,
                                                   ISceneObjectEntityFactory mapObjectEntityFactory, PlayerEntity player)
        {
            switch (message.Command)
            {
            case DebugCommands.ClearSceneObject:
                context.DestroyAllEntities();
                break;

            case DebugCommands.ListDoorEntity:
                var mapEntities = context.GetEntities();
                for (int i = 0; i < mapEntities.Length; ++i)
                {
                    var mapEntity = mapEntities[i];
                    if (mapEntity.hasDoorData && mapEntity.hasRawGameObject)
                    {
                        var obj = mapEntity.rawGameObject.Value;

                        string path = "/" + obj.name;
                        while (obj.transform.parent != null)
                        {
                            obj  = obj.transform.parent.gameObject;
                            path = "/" + obj.name + path;
                        }

                        Logger.InfoFormat("DoorEntity {0} {1}", mapEntity, path);
                    }
                }
                break;
            }
        }
Exemple #4
0
 public SurvivalPickupLogic(PlayerContext playerContext,
                            SceneObjectContext sceneObjectContext,
                            ISceneObjectEntityFactory sceneObjectEntityFactory,
                            RuntimeGameConfig runtimeGameConfig)
 {
     _playerContext            = playerContext;
     _runtimeGameConfig        = runtimeGameConfig;
     _sceneObjectEntityFactory = sceneObjectEntityFactory;
     _autoPickupLogic          = new AutoPickupLogic(sceneObjectContext, playerContext, sceneObjectEntityFactory);
 }
Exemple #5
0
 public NormalPickupLogic(SceneObjectContext sceneObjectContext,
                          PlayerContext playerContext,
                          ISceneObjectEntityFactory sceneObjectEntityFactory,
                          RuntimeGameConfig runtimeGameConfig,
                          int sceneWeaponLifetime)
 {
     _sceneObjectContext       = sceneObjectContext;
     _playerContext            = playerContext;
     _sceneObjectEntityFactory = sceneObjectEntityFactory;
     _sceneWeaponLifeTime      = sceneWeaponLifetime;
     _runtimeGameConfig        = runtimeGameConfig;
     _autoPickupLogic          = new AutoPickupLogic(sceneObjectContext, playerContext, sceneObjectEntityFactory);
 }
 public PlayerWeaponActionLogic(
     PlayerEntity player,
     WeaponBagLogic bagLogic,
     ISceneObjectEntityFactory sceneObjectEntityFactory,
     IReservedBulletLogic reservedBulletLogic,
     IGrenadeBagCacheAgent grenadeInventory,
     IWeaponSlotController weaponSlotController,
     IWeaponActionListener weaponActionListener)
 {
     _playerEntity         = player;
     _weaponBagLogic       = bagLogic;
     _weaponSlotController = weaponSlotController;
     _slotAuxiliary        = new WeaponSlotAuxiliary(player,
                                                     weaponSlotController,
                                                     this,
                                                     reservedBulletLogic,
                                                     grenadeInventory);
     _weaponActionListener = weaponActionListener;
 }
        public static void ProcessSceneObjectCommand(DebugCommand message, SceneObjectContext context,
                                                     ISceneObjectEntityFactory sceneObjectEntityFactory, PlayerEntity player)
        {
            switch (message.Command)
            {
            case DebugCommands.CreateSceneObject:
                int category;
                int id;
                if (int.TryParse(message.Args[0], out category) && int.TryParse(message.Args[1], out id))
                {
                    sceneObjectEntityFactory.CreateSimpleObjectEntity((Assets.XmlConfig.ECategory)category, id,
                                                                      1, player.position.Value);
                }
                break;

            case DebugCommands.ClearSceneObject:
                context.DestroyAllEntities();
                break;
            }
        }
 public ServerFreeCastSceneEntityDestroySystem(Contexts contexts)
 {
     _sceneObjectEntityFactory = contexts.session.entityFactoryObject.SceneObjectEntityFactory;
     _castSceneObjectGroup     = contexts.sceneObject.GetGroup(SceneObjectMatcher.SimpleCastTarget);
 }
Exemple #9
0
 public PickupDropHandlerAdapter(Contexts context)
 {
     sceneObjectEntityFactory = context.session.entityFactoryObject.SceneObjectEntityFactory;
     commonSession            = context.session.commonSession;
 }
 public AutoPickupLogic(SceneObjectContext sceneObjectContext, PlayerContext playerContext, ISceneObjectEntityFactory sceneObjectEntityFactory)
 {
     _sceneObjectContext       = sceneObjectContext;
     _playerContext            = playerContext;
     _sceneObjectEntityFactory = sceneObjectEntityFactory;
 }
        public static void CreateDropItem(PlayerEntity player, int cat, int id, int count, ISceneObjectEntityFactory factory)
        {
            var dropPos = player.position.Value + player.characterContoller.Value.transform.forward * 2;

            if (player != null)
            {
                RaycastHit hit;
                Vector3    throwPos = player.GetHandWeaponPosition();
                Ray        ray      = new Ray(throwPos, dropPos - throwPos);
                if (Physics.Raycast(ray, out hit, Vector3.Distance(throwPos, dropPos) - 0.01f, UnityLayers.PickupObstacleLayerMask))
                {
                    RaycastHit vhit;
                    if (Physics.Raycast(hit.point + new Vector3(0, 0.1f, 0), Vector3.down, out vhit, 100, UnityLayers.PickupObstacleLayerMask))
                    {
                        dropPos = vhit.point;
                    }
                    else
                    {
                        dropPos = hit.point;
                    }
                }
                else
                {
                    RaycastHit vhit;
                    if (Physics.Raycast(dropPos + new Vector3(0, 0.1f, 0), Vector3.down, out vhit, 100, UnityLayers.PickupObstacleLayerMask))
                    {
                        dropPos = vhit.point;
                    }
                }
            }
            factory.CreateSimpleObjectEntity((ECategory)cat, id, count, dropPos, count);
        }