Пример #1
0
 public ThrowingFactory(ThrowingContext throwingContext, IEntityIdGenerator entityIdGenerator, WeaponResConfigItem newWeaponConfig, ThrowingConfig throwingConfig)
 {
     _throwingContext   = throwingContext;
     _entityIdGenerator = entityIdGenerator;
     _newWeaponConfig   = newWeaponConfig;
     _config            = throwingConfig;
 }
        public static ThrowingEntity CreateThrowingEntity(
            ThrowingContext throwingContext,
            IEntityIdGenerator entityIdGenerator,
            PlayerEntity playerEntity,
            int serverTime, Vector3 dir, float initVel,
            NewWeaponConfigItem newWeaponConfig,
            ThrowingConfig throwingConfig)
        {
            int throwingEntityId = entityIdGenerator.GetNextEntityId();

            var     emitPost       = PlayerEntityUtility.GetThrowingEmitPosition(playerEntity);
            Vector3 velocity       = dir * initVel;
            var     throwingEntity = throwingContext.CreateEntity();

            throwingEntity.AddEntityKey(new EntityKey(throwingEntityId, (int)EEntityType.Throwing));

            throwingEntity.AddThrowingData(
                velocity,
                false,
                false,
                0,
                serverTime,
                false,
                initVel,
                throwingConfig,
                newWeaponConfig.SubType
                );

            throwingEntity.AddPosition(emitPost);
            throwingEntity.AddOwnerId(playerEntity.entityKey.Value);
            throwingEntity.isFlagSyncNonSelf = true;
            throwingEntity.AddLifeTime(DateTime.Now, throwingConfig.CountdownTime + 2000);
            return(throwingEntity);
        }
Пример #3
0
        public static ThrowingEntity CreateThrowingEntity(PlayerWeaponController controller, int serverTime,
                                                          Vector3 dir, Vector3 viePos, float initVel,
                                                          WeaponResConfigItem newWeaponConfig,
                                                          ThrowingConfig throwingConfig)
        {
            int throwingEntityId = EntityIdGenerator.GetNextEntityId();


            Vector3        velocity       = dir * initVel;
            ThrowingEntity throwingEntity = ThrowingContext.CreateEntity();

            throwingEntity.AddEntityKey(new EntityKey(throwingEntityId, (int)EEntityType.Throwing));
            // throwingEntity.AddThrowingData(velocity, false, false, 0, serverTime, false, initVel, throwingConfig,
            //     newWeaponConfig.SubType);
            throwingEntity.AddThrowingData(throwingConfig, newWeaponConfig, initVel, 0, serverTime, velocity, newWeaponConfig.SubType);
            throwingEntity.AddPosition();
            //TODO:EmitPos,ViewPos做射线检测取合适的点
            throwingEntity.position.Value = viePos;
            throwingEntity.AddOwnerId(controller.Owner);
            throwingEntity.isFlagSyncNonSelf = true;
            throwingEntity.AddLifeTime(DateTime.Now, throwingConfig.CountdownTime + 2000);
            _logger.InfoFormat("CreateThrowing from {0} with velocity {1}, entity key {2}",
                               throwingEntity.position.Value, throwingEntity.throwingData.Velocity, throwingEntity.entityKey);
            return(throwingEntity);
        }
 public override IThrowingFactory CreateThrowingFactory(NewWeaponConfigItem newWeaponConfig, ThrowingConfig config)
 {
     return(new ThrowingFactory(_throwingContext, _entityIdGenerator, newWeaponConfig, config));
 }
Пример #5
0
 public IThrowingFactory CreateThrowingFactory(WeaponResConfigItem newWeaponConfig, ThrowingConfig config)
 {
     return(new ThrowingFactory(_contexts.throwing, _entityIdGenerator, newWeaponConfig, config));
 }
 public abstract IThrowingFactory CreateThrowingFactory(NewWeaponConfigItem newWeaponConfig, ThrowingConfig config);
 public static void SetReady(this ThrowingActionData throwingActionData, int currKey, ThrowingConfig config)
 {
     throwingActionData.IsReady           = true;
     throwingActionData.Config            = config;
     throwingActionData.LastFireWeaponKey = currKey;
 }
Пример #8
0
 public static float GetThrowingInitSpeed(this ThrowingConfig throwingConfig, bool isNear)
 {
     return(isNear ? throwingConfig.NearInitSpeed : throwingConfig.FarInitSpeed);
 }