public override void OnExecute()
        {
            RefreshTargetBuffTimeBuffData refreshTargetBuffTimeBuffData = this.BuffData as RefreshTargetBuffTimeBuffData;
            BuffManagerComponent          buffManagerComponent;

            if (this.BuffData.BuffTargetTypes == BuffTargetTypes.Self)
            {
                buffManagerComponent = this.TheUnitFrom.GetComponent <BuffManagerComponent>();
            }
            else
            {
                buffManagerComponent = this.TheUnitBelongto.GetComponent <BuffManagerComponent>();
            }

            foreach (var buffNodeId in refreshTargetBuffTimeBuffData.TheBuffNodeIdToBeRefreshed)
            {
                //Log.Info($"准备刷新指定Buff——{buffId}持续时间");
                ABuffSystemBase aBuffSystemBase =
                    buffManagerComponent.GetBuffById(
                        (this.BelongtoRuntimeTree.BelongNP_DataSupportor.BuffNodeDataDic[buffNodeId.Value] as NormalBuffNodeData).BuffData
                        .BuffId);
                if (aBuffSystemBase != null && aBuffSystemBase.BuffData.SustainTime + 1 > 0)
                {
                    // Log.Info(
                    //     $"刷新了指定Buff——{buffId}持续时间{TimeHelper.Now() + buffSystemBase.MSkillBuffDataBase.SustainTime},原本为{buffSystemBase.MaxLimitTime}");
                    aBuffSystemBase.MaxLimitTime = TimeHelper.Now() + aBuffSystemBase.BuffData.SustainTime;
                }
            }

            this.BuffState = BuffState.Finished;
        }
        public override void OnExecute()
        {
            SendBuffInfoToClientBuffData sendBuffInfoToClientBuffData = this.BuffData as SendBuffInfoToClientBuffData;

            ABuffSystemBase targetBuffSystem = this.TheUnitBelongto.GetComponent <BuffManagerComponent>()
                                               .GetBuffById(
                (this.BelongtoRuntimeTree.BelongNP_DataSupportor.BuffNodeDataDic[sendBuffInfoToClientBuffData.TargetBuffNodeId.Value] as
                 NormalBuffNodeData).BuffData.BuffId);

            Game.EventSystem.Run(EventIdType.SendBuffInfoToClient,
                                 new M2C_BuffInfo()
            {
                UnitId            = this.BelongtoRuntimeTree.BelongToUnitId,
                SkillId           = sendBuffInfoToClientBuffData.BelongToSkillId.Value,
                BBKey             = sendBuffInfoToClientBuffData.BBKey.BBKey,
                TheUnitFromId     = this.TheUnitFrom.Id,
                TheUnitBelongToId = this.TheUnitBelongto.Id,
                BuffLayers        = targetBuffSystem.CurrentOverlay,
                BuffMaxLimitTime  = targetBuffSystem.MaxLimitTime,
            });
            this.BuffState = BuffState.Finished;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取Buff 目标,之所以需要这个拓展方法,因为ABuffSystemBase的TheUnitFrom和TheUnitBelongto被赋值于Buff链起源的地方,具体值取决于那个起源Buff
 /// </summary>
 /// <param name="self"></param>
 /// <returns></returns>
 public static Unit GetBuffTarget(this ABuffSystemBase self)
 {
     return(self.BuffData.BuffTargetTypes == BuffTargetTypes.Self? self.TheUnitFrom : self.TheUnitBelongto);
 }