コード例 #1
0
        private bool StopImpactImpl(CharacterInfo target, int impactId)
        {
            ImpactInfo impactInfo = target.GetSkillStateInfo().GetImpactInfoById(impactId);

            if (null != impactInfo)
            {
                IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(impactInfo.ConfigData.ImpactLogicId);
                if (null != logic && logic.CanInterrupt(target, impactId))
                {
                    logic.OnInterrupted(target, impactId);
                    impactInfo.m_IsActivated = false;
                    return(true);
                }
            }
            return(false);
        }
コード例 #2
0
        public void Tick(CharacterInfo obj)
        {
            List <ImpactInfo> impactInfos = obj.GetSkillStateInfo().GetAllImpact();
            int ct = impactInfos.Count;

            for (int i = ct - 1; i >= 0; --i)
            {
                ImpactInfo   info  = impactInfos[i];
                IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(info.ConfigData.ImpactLogicId);
                if (info.m_IsActivated)
                {
                    if (null != logic)
                    {
                        logic.Tick(obj, info.m_ImpactId);
                    }
                }
                else
                {
                    logic.OnInterrupted(obj, info.m_ImpactId);
                    obj.GetSkillStateInfo().RemoveImpact(info.m_ImpactId);
                }
            }
            obj.GetSkillStateInfo().CleanupImpactInfoForCheck(TimeUtility.GetServerMilliseconds(), 5000);//用于校验的impact比正常时间晚5秒清除
        }
コード例 #3
0
        private bool SendImpactImpl(CharacterInfo sender, int impactId, int targetId, int skillId, int duration)
        {
            //LogSystem.Debug("character {0} send impact {1} to character {2}", sender.GetId(), impactId, targetId);
            if (null != sender)
            {
                CharacterInfo target = sender.SceneContext.GetCharacterInfoById(targetId);
                if (null != target)
                {
                    if (target.IsUser && target.IsDead())
                    {
                        return(false);
                    }
                    if (target.IsNpc && target.IsDead())
                    {
                        NpcInfo npc = target.CastNpcInfo();
                        if ((int)NpcTypeEnum.SceneObject == npc.NpcType)
                        {
                            return(false);
                        }
                    }
                    ImpactLogicData impactLogicData = SkillConfigProvider.Instance.ExtractData(SkillConfigType.SCT_IMPACT, impactId) as ImpactLogicData;
                    if (null != impactLogicData)
                    {
                        IImpactLogic logic = ImpactLogicManager.Instance.GetImpactLogic(impactLogicData.ImpactLogicId);
                        if (null != logic)
                        {
                            ImpactInfo oldImpactInfo = target.GetSkillStateInfo().GetImpactInfoById(impactId);
                            if (null != oldImpactInfo)
                            {
                                logic.OnInterrupted(target, impactId);
                                target.GetSkillStateInfo().RemoveImpact(impactId);
                            }
                            ImpactInfo impactInfo = new ImpactInfo();
                            impactInfo.m_IsActivated    = true;
                            impactInfo.m_SkillId        = skillId;
                            impactInfo.m_ImpactId       = impactLogicData.ImpactId;
                            impactInfo.m_ImpactType     = impactLogicData.ImpactType;
                            impactInfo.m_BuffDataId     = impactLogicData.BuffDataId;
                            impactInfo.ConfigData       = impactLogicData;
                            impactInfo.m_StartTime      = TimeUtility.GetServerMilliseconds();
                            impactInfo.m_ImpactDuration = impactLogicData.ImpactTime;
                            if (-1 == duration || duration > impactLogicData.ImpactTime)
                            {
                                impactInfo.m_ImpactDuration = impactLogicData.ImpactTime;
                            }
                            else
                            {
                                impactInfo.m_ImpactDuration = duration;
                            }
                            impactInfo.m_HasEffectApplyed = false;
                            if (0 == impactInfo.ConfigData.ImpactGfxLogicId)
                            {
                                impactInfo.m_IsGfxControl = false;
                            }
                            else
                            {
                                impactInfo.m_IsGfxControl = true;
                            }
                            impactInfo.m_ImpactSenderId  = sender.GetId();
                            impactInfo.m_MaxMoveDistance = impactLogicData.CalcMaxMoveDistance();
                            if (impactLogicData.ImpactGfxLogicId == 0)
                            {
                                impactInfo.m_LeftEnableMoveCount = 0;//禁止位移
                            }
                            else
                            {
                                impactInfo.m_LeftEnableMoveCount = 1;//允许位移
                            }

                            //LogSystem.Warn("impact {0} EnableMoveCount {1} MaxMoveDistanceSqr {2}", impactId, impactInfo.m_LeftEnableMoveCount, impactInfo.m_MaxMoveDistanceSqr);

                            target.GetSkillStateInfo().AddImpact(impactInfo);
                            logic.StartImpact(target, impactId);

                            if ((int)ImpactType.INSTANT == impactInfo.m_ImpactType)
                            {
                                impactInfo.m_IsActivated = false;
                            }
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }