Beispiel #1
0
        //2.创建buff特效
        public BuffEffect CreateBuffEffect(Ientity buffEntity, uint buffTypeID, uint instID)
        {
            BuffConfigInfo buffInfo = ConfigReader.GetBuffInfo(buffTypeID);


            //判断是否有后续击飞效果
            if (buffInfo != null && buffInfo.eFlyEffectID != 0)
            {
                //获取击飞信息
                SkillFlyConfig skillFlycfg = ConfigReader.GetSkillFlyConfig(buffInfo.eFlyEffectID);
                if (skillFlycfg != null && buffEntity != null)
                {
                    //Iplayer player = buffEntity as Iplayer;

                    //被击飞信息
                    string beatFLyAction = skillFlycfg.moveAction;
                    float  raiseSpeed    = skillFlycfg.raiseSpeed;
                    float  raiseAccSpeed = skillFlycfg.raiseAccSpeed;
                    float  fallSpeed     = skillFlycfg.fallSpeed;
                    float  fallAccSpeed  = skillFlycfg.fallAccSpeed;
                    float  stayTime      = skillFlycfg.stayTime;
                    int    canbeRecover  = skillFlycfg.bIsCanBeRecover;

                    buffEntity.OnBeatFly(buffInfo.BuffID, beatFLyAction, raiseSpeed, raiseAccSpeed, fallSpeed, fallAccSpeed, stayTime, canbeRecover);
                }
            }

            //判断资源路径是否有效
            if (buffInfo == null || buffInfo.EffectRes == "0")
            {
                return(null);
            }

            string resourcePath = GameConstDefine.LoadGameBuffEffectPath + buffInfo.EffectRes;


            //加载特效信息
            BuffEffect effect = new BuffEffect();

            effect.InstID    = instID;
            effect.entity    = buffEntity;
            effect.projectID = instID;
            effect.resPath   = resourcePath;

            //创建特效
            effect.Create();

            //创建声音
            string soundName = GameConstDefine.LoadGameSoundPath + buffInfo.sound;

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

            //保存特效列表
            AddEffect(effect.projectID, effect);

            return(effect);
        }