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);
        }
示例#2
0
 public ThrowingFactory(ThrowingContext throwingContext, IEntityIdGenerator entityIdGenerator, WeaponResConfigItem newWeaponConfig, ThrowingConfig throwingConfig)
 {
     _throwingContext   = throwingContext;
     _entityIdGenerator = entityIdGenerator;
     _newWeaponConfig   = newWeaponConfig;
     _config            = throwingConfig;
 }
示例#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);
        }
示例#4
0
        public static void DestroyThrowing(EntityKey entityKey)
        {
            ThrowingEntity throwing = ThrowingContext.GetEntityWithEntityKey(entityKey);

            if (null != throwing)
            {
                throwing.isFlagDestroy = true;
            }
        }
示例#5
0
        public static void StartThrowingEntityFly(EntityKey entityKey, bool isThrow, float initVel)
        {
            ThrowingEntity throwing = ThrowingContext.GetEntityWithEntityKey(entityKey);

            if (null != throwing)
            {
                throwing.throwingData.IsThrow      = isThrow;
                throwing.throwingData.InitVelocity = initVel;
            }
        }
 public WeaponLogicComponentsFactory(
     Contexts contexts,
     IEntityIdGenerator entityIdGenerator,
     ICurrentTime currentTime,
     IAttachmentManager attachmentManager,
     ISoundEntityFactory soundEntityFactory,
     IBulletEntityFactory bulletEntityFactory) : base(attachmentManager)
 {
     _bulletContext       = contexts.bullet;
     _throwingContext     = contexts.throwing;
     _clientEffectContext = contexts.clientEffect;
     _soundContext        = contexts.sound;
     _entityIdGenerator   = entityIdGenerator;
     _currentTime         = currentTime;
     _attachmentManager   = attachmentManager;
     _soundEntityFactory  = soundEntityFactory;
     _bulletEntityFactory = bulletEntityFactory;
 }
 public ClearSceneMessageHandler(Contexts contexts)
 {
     _clientEffectContext = contexts.clientEffect;
     _throwingContext     = contexts.throwing;
 }
 public ThrowingGameContext(ThrowingContext context, Bin2D <IGameEntity> bin) : base(context, ThrowingComponentsLookup.componentTypes, bin)
 {
 }
 public ThrowingCleanUpSystem(ThrowingContext throwingContext)
 {
     _group = throwingContext.GetGroup(ThrowingMatcher.AllOf(ThrowingMatcher.FlagDestroy));
 }