コード例 #1
0
        private void CreateBulletEffect(WeaponAttackProxy attackProxy, ICharacterBone bones)
        {
            if (DefaultCfg.BulletFly < 1 || attackProxy.IsAiming)
            {
                return;
            }
            var muzzleTrans = bones.GetLocation(SpecialLocation.MuzzleEffectPosition,
                                                attackProxy.Appearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson);

            if (!muzzleTrans)
            {
                return;
            }
            var efcCommonCfg = SingletonManager.Get <ClientEffectCommonConfigManager>()
                               .GetConfigByType(EEffectObjectClassify.BulletFly);

            foreach (var bulletData in attackProxy.Owner.BulletList)
            {
                var origin   = bulletData.ViewPosition;
                var velocity = efcCommonCfg.Velocity * bulletData.Dir;

                Vector3 target = origin + velocity * 1.0f;
                Vector3 bulletEffectVelocity = (target - bulletData.EmitPosition) / 1.0f;
                ClientEffectFactory.CreateBulletFlyEffect(attackProxy.Owner.Owner, muzzleTrans.position,
                                                          muzzleTrans.rotation, bulletEffectVelocity, DefaultCfg.BulletFly, efcCommonCfg.Delay);
            }
        }