Ejemplo n.º 1
0
 private void DealDamage(DamageCom damageCom)
 {
     if (damageCom.Damages == null || damageCom.Damages.Count <= 0)
     {
         return;
     }
     for (int i = 0; i < damageCom.Damages.Count; i++)
     {
         AddDamageInfo damageInfo = damageCom.Damages[i];
         //执行攻击者的Buff,OnHit函数
         ExecuteHurtFunc(damageInfo);
         //执行目标者的Buff,BeHurt函数
         ExecuteBeHurtFunc(damageInfo);
         //执行伤害
         bool isDead = SkillLocate.Damage.CalcDamage(damageInfo);
         //执行死亡的Buff函数
         if (isDead)
         {
             //攻击者Kill
             ExecuteKilledFunc(damageInfo);
             //目标OnBeKilled
             ExecuteBeKilledFunc(damageInfo);
         }
         //伤害结束,添加Buff
         for (int j = 0; j < damageInfo.model.addBuffs.Count; j++)
         {
             AddBuffModel addBuff = damageInfo.model.addBuffs[j];
             SkillLocate.Skill.CreateBuff(damageInfo.attacker, damageInfo.target, addBuff);
         }
         //移除
         damageCom.RemoveDamageInfo(damageInfo);
     }
 }
Ejemplo n.º 2
0
 private void ExecuteKilledFunc(AddDamageInfo damageInfo)
 {
     if (damageInfo.attacker == null)
     {
         return;
     }
     //执行攻击者的Buff,OnHit函数
     for (int i = 0; i < damageInfo.attacker.Buffs.Count; i++)
     {
         BuffObj killBuff = damageInfo.attacker.Buffs[i];
         if (killBuff.model.onKilledFunc != null)
         {
             for (int j = 0; j < killBuff.model.onKilledFunc.Count; j++)
             {
                 BuffKilledFunc func = killBuff.model.onKilledFunc[j];
                 func.Execute(killBuff, damageInfo, damageInfo.target);
             }
         }
     }
 }
Ejemplo n.º 3
0
 private void ExecuteHurtFunc(AddDamageInfo damageInfo)
 {
     if (damageInfo.attacker == null)
     {
         return;
     }
     //执行攻击者的Buff,OnHit函数
     for (int i = 0; i < damageInfo.attacker.Buffs.Count; i++)
     {
         BuffObj hitBuff = damageInfo.attacker.Buffs[i];
         if (hitBuff.model.onHurtFunc != null)
         {
             for (int j = 0; j < hitBuff.model.onHurtFunc.Count; j++)
             {
                 BuffHurtFunc func = hitBuff.model.onHurtFunc[j];
                 func.Execute(hitBuff, ref damageInfo, damageInfo.target);
             }
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 执行函数
 /// </summary>
 /// <param name="buff">buff对象</param>
 /// <param name="damageInfo">伤害信息</param>
 /// <param name="attacker">攻击者</param>
 public abstract void Execute(BuffObj buff, AddDamageInfo damageInfo, SkillCom attacker);
Ejemplo n.º 5
0
 /// <summary>
 /// 执行函数
 /// </summary>
 /// <param name="buff">Buff对象</param>
 /// <param name="damageInfo">伤害信息</param>
 /// <param name="target">被击杀目标</param>
 public abstract void Execute(BuffObj buff, AddDamageInfo damageInfo, SkillCom target);