Exemple #1
0
        /// <summary>
        /// 实施技能效果
        /// </summary>
        private void DoSkillEffect(SkillActive skill)
        {
            //是否有飞行时长投射?
            float flyTime = 0f;
            float speed   = skill.SkillData.throwEffectSpeed;

            if (speed > 0)
            {
                flyTime = skill.mDistance / speed;
            }

            //按实际飞行时长计算
            if (flyTime > 0)
            {
                DelayDoSkillRealEffect(skill, flyTime);
            }
            else
            {
                DoSkillRealEffect(skill);
                if (skill.mHitIndex >= skill.LvData.hitTime.Length)
                {
                    skill.Reset();
                }
            }
        }
Exemple #2
0
        private void OnSkillRealEffectEvent(TimerEvent timerEvent)
        {
            SkillActive skill = timerEvent.param as SkillActive;

            DoSkillRealEffect(skill);
            if (skill.mHitIndex >= skill.LvData.hitTime.Length)
            {
                skill.Reset();
            }
        }
Exemple #3
0
        /// <summary>
        /// 取消释放技能
        /// </summary>
        public bool CancelSpell()
        {
            if (null == mCurrSkill)
            {
                return(false);
            }

            mCurrSkill.Reset();

            return(true);
        }
Exemple #4
0
        public bool CastSpell(SkillActive skill, ulong targetId)
        {
            if (null == skill || null == skill.Data)
            {
                return(false);
            }

            skill.mResult = eSkillResult.CastFailed;

            if (mPlayerStatus.IsHasBuffStatus(eBuffStatusType.眩晕))
            {
                return(false);
            }

            if (skill.mStatus != eSkillStatus.Valid)
            {
                return(false);
            }

            if (skill.mStep != eSkillStep.Init)
            {
                return(false);
            }

            //检查条件
            RoleActor target = mHostMap.GetRole(targetId);

            if (null != skill.Checker)
            {
                skill.mStep = eSkillStep.Check;
                //预选择目标检查
                if (!skill.Checker.PreSelectTarget(this, skill, target))
                {
                    skill.Reset();
                    return(false);
                }
                if (null != target)
                {
                    skill.mDistance = Util.DistanceH(target.GetPosition(), GetPosition());
                }
                if (!skill.Checker.CheckSkillCondition(this, skill))
                {
                    skill.Reset();
                    return(false);
                }
            }

            //检查消耗
            if (null != skill.Consumer)
            {
                skill.mStep = eSkillStep.Consume;
                if (!skill.Consumer.CheckSkillConsume(this, skill))
                {
                    skill.Reset();
                    return(false);
                }
                //实际消耗
                //if (!skill.Consumer.SkillConsume(this, skill))
                //{
                //    skill.Reset();
                //    return false;
                //}
            }

            if (skill.SkillData.cdTime > 0)
            {
                //技能CD
                float cdTime = skill.SkillData.cdTime;
                cdTime -= GameSet.Instance.SkillCDTimeSync;
                skill.SkillCD.AddCoolDown(cdTime, Time.time + cdTime);
                float protectTime = new float[] { skill.SkillData.protectTime, CSCommon.SCDefine.cCommonCD }.Max();
                protectTime -= GameSet.Instance.SkillCDTimeSync;
                SkillCD.AddCoolDown(protectTime, Time.time + protectTime);
            }

            //广播技能效果
            var pkg = new RPC.PackageWriter();

            Wuxia.H_RpcRoot.smInstance.HIndex(pkg, Id).RPC_SpellSkill(pkg, skill.ID, skill.mTargetId);
            HostMap.SendPkg2Clients(null, this.GetPosition(), pkg);

            mCurrSkill = skill;

            //实际释放技能
            return(DoCastSkill(skill));
        }