Exemple #1
0
        //3.创建基于时间的特效
        public BeAttackEffect CreateTimeBasedEffect(string res, float time, Ientity entity)
        {
            if (res == "0")
            {
                return(null);
            }

            BeAttackEffect effect = new BeAttackEffect();

            //加载特效信息
            effect.skillID     = 0;         //技能id=0
            effect.cehuaTime   = time;
            effect.enTargetKey = entity.GameObjGUID;
            effect.resPath     = res;
            //创建
            effect.Create();

            AddEffect(effect.projectID, effect);
            return(effect);
        }
Exemple #2
0
        //7.创建受击特效
        public BeAttackEffect CreateBeAttackEffect(UInt64 owner, UInt64 target, uint skillID)
        {
            SkillAccountConfig skillAccConfig = ConfigReader.GetSkillAccountCfg(skillID);

            //判断是否有后续屏幕振动效果
            if (skillAccConfig != null && skillAccConfig.cameraId != 0)
            {
                //振动类型1 释放为本机振动  2受机为本机振动
                bool shakeFlag = false;
                if (skillAccConfig.cameraTarget == 1)
                {
                    Ientity ownerEntity = null;
                    EntityManager.AllEntitys.TryGetValue(owner, out ownerEntity);

                    if (ownerEntity != null && ownerEntity is Iselfplayer)
                    {
                        shakeFlag = true;
                    }
                }
                else if (skillAccConfig.cameraTarget == 2)
                {
                    Ientity targetEntity = null;
                    EntityManager.AllEntitys.TryGetValue(target, out targetEntity);

                    if (targetEntity != null && targetEntity is Iselfplayer)
                    {
                        shakeFlag = true;
                    }
                }
                else if (skillAccConfig.cameraTarget == 3)
                {
                    Ientity ownerEntity  = null;
                    Ientity targetEntity = null;
                    EntityManager.AllEntitys.TryGetValue(owner, out ownerEntity);
                    EntityManager.AllEntitys.TryGetValue(target, out targetEntity);

                    if ((ownerEntity != null && ownerEntity is Iselfplayer) || targetEntity != null && targetEntity is Iselfplayer)
                    {
                        shakeFlag = true;
                    }
                }

                if (shakeFlag)
                {
                    //获屏幕振动信息
                    SkillCameraConfig skillCameracfg = ConfigReader.GetSkillCameraConfig(skillAccConfig.cameraId);
                    if (skillCameracfg != null)
                    {
                        //被击飞信息
                        float period      = skillCameracfg.mPeriod;
                        float offPeriod   = skillCameracfg.mOffPeriod;
                        int   shakeOrient = skillCameracfg.mShakeOrient;
                        float shakeTime   = skillCameracfg.mShakeTime;
                        float maxWave     = skillCameracfg.mMaxWave;
                        float minWave     = skillCameracfg.mMinWave;

                        Shakecamera(period, offPeriod, shakeOrient, shakeTime, maxWave, minWave);
                    }
                }
            }


            //判断路径是否有效
            if (skillAccConfig == null || skillAccConfig.effect == "0")
            {
                return(null);
            }


            //加载特效信息
            Ientity entityOwner, entityTarget;

            EntityManager.AllEntitys.TryGetValue(owner, out entityOwner);
            EntityManager.AllEntitys.TryGetValue(target, out entityTarget);

            //根据受击特效跟玩家距离判断是否需要创建特效
            if (entityTarget != null)
            {
                if (!CheckEffectValid(entityTarget.objTransform.position, skillAccConfig.lifeTime))
                {
                    return(null);
                }
            }

            string         resourcePath = GameConstDefine.LoadGameSkillEffectPath + "hit/" + skillAccConfig.effect;
            BeAttackEffect effect       = new BeAttackEffect();

            if (entityTarget != null)
            {
                effect.enTargetKey = entityTarget.GameObjGUID;
            }

            if (entityOwner == null)
            {
                return(null);
            }

            effect.enOwnerKey = entityOwner.GameObjGUID;

            effect.skillID   = skillID;
            effect.resPath   = resourcePath;
            effect.cehuaTime = skillAccConfig.lifeTime;

            //创建
            effect.Create();
            //播放声音
            string soundPath = GameConstDefine.LoadGameSoundPath + skillAccConfig.sound;

            if (skillAccConfig.sound != "0")
            {
                PlayAudio(effect, soundPath, effect.obj);
            }

            AddEffect(effect.projectID, effect);
            return(effect);
        }