diff --git a/Role/Attack.cs b/Role/Attack.cs index dbde790..959229d 100644 --- a/Role/Attack.cs +++ b/Role/Attack.cs @@ -42,7 +42,8 @@ public class Attack : MonoBehaviour [Header("子弹分裂个数")] public int splitNum = 2; [Header("分裂子弹伤害")] public float SplitAttack = 10; [Header("子弹围绕范围")] public float RunRange = 3f; - + [Header("是否造成额外伤害")] public bool haveAddDamage = false; + [Header("额外伤害类型")] public DamageType AdddamageType=DamageType.magicDamage; public bool isAttack = true; public bool flag = false; [HideInInspector] public float timer = 0; @@ -446,6 +447,8 @@ public class Attack : MonoBehaviour private int lastBulletNumber = 0; // 记录上一次的 BulletNumber + private float lastbulletLengthAdd = 0; // 记录上一次的 BulletNumber + public float bulletLengthAdd = 0f; // 子弹的长度属性 public void RunRangeattack() // 生成在周围 { @@ -456,10 +459,10 @@ public class Attack : MonoBehaviour } // 只有在 BulletNumber 变化时,才重新生成子弹 - if (BulletNumber != lastBulletNumber) + if (BulletNumber != lastBulletNumber||lastbulletLengthAdd!=bulletLengthAdd) // 检查 BulletNumber 和 bulletLength 是否变化 { // 销毁现有的所有子弹 - if (bulltes.Count>0) + if (bulltes.Count > 0) { foreach (var bullet in bulltes) { @@ -467,7 +470,6 @@ public class Attack : MonoBehaviour } bulltes.Clear(); // 清空子弹列表 } - // 计算子弹发射的圆周角度间隔 float angleStep = 360f / BulletNumber; // 计算每个子弹之间的角度间隔 @@ -504,14 +506,24 @@ public class Attack : MonoBehaviour // 设置子弹的朝向和位置 BulletGamobj.transform.up = scatterDirection; // 让子弹的"up"方向指向计算出的角度 BulletGamobj.transform.position = position; // 更新子弹的位置 + + if (lastbulletLengthAdd != bulletLengthAdd) + { + // 根据 bulletLength 设置子弹的长度 + BulletGamobj.transform.localScale = new Vector3(BulletGamobj.transform.localScale.x + bulletLengthAdd, BulletGamobj.transform.localScale.y, BulletGamobj.transform.localScale.z); + } + } - // 更新记录的 BulletNumber + + + + // 更新记录的 BulletNumber 和 bulletLength lastBulletNumber = BulletNumber; + lastbulletLengthAdd = bulletLengthAdd; } } - } diff --git a/Role/Fun.cs b/Role/Fun.cs index 6a26c41..7b57101 100644 --- a/Role/Fun.cs +++ b/Role/Fun.cs @@ -55,7 +55,7 @@ public class Fun : Base /// Ѫ Ŀ,˺ֵ,,ʹߣӵķ0ұߣ1ߣ /// /// - public void bloodLoss(object[] objects,int direction=1)//Ŀ,˺ֵ,,ʹ,ӵķ + public void bloodLoss(object[] objects,int direction=1)//Ŀ,˺ֵ,,ʹ,ӵķ { Role targetAudience = (Role)objects[0]; float harm = (float)objects[1]; @@ -70,6 +70,8 @@ public class Fun : Base break; case DamageType.magicDamage://ħ˺ finalDamage -= targetAudience.magicArmor; + targetAudience.isMoFa = true; + Debug.Log("ħ˺"); break; case DamageType.noAttributeDamage://˺ finalDamage -= 0; diff --git a/Role/Role.cs b/Role/Role.cs index 1b44233..469bf9b 100644 --- a/Role/Role.cs +++ b/Role/Role.cs @@ -71,7 +71,7 @@ public class Role : Fun public float CritRate;//暴击率 public float CriticalHitRateBonus;//暴击加成 [Header("击杀数量")] public int killNum; - + [Header("是不是魔法伤害")] public bool isMoFa=false; public float Hp { get => hp; @@ -115,9 +115,20 @@ public class Role : Fun { go.GetComponent().CreateText(); } + if (temp - hp>0) { - go.GetComponent().text = (temp - hp).ToString("F0"); // 显示伤害值 + if (isMoFa) + { + + go.GetComponent().text = "" + (temp - hp).ToString("F0") + ""; // 显示伤害值 + isMoFa = false; + } + else + { + go.GetComponent().text = (temp - hp).ToString("F0"); // 显示伤害值 + } + } } diff --git a/Role/RunRangeBullet.cs b/Role/RunRangeBullet.cs index 7702c1e..5975ffa 100644 --- a/Role/RunRangeBullet.cs +++ b/Role/RunRangeBullet.cs @@ -51,6 +51,10 @@ public class RunRangeBullet : Bullet direction = 1; } Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent()), attackObj.damageTyp, role }, direction); + if (attackObj.haveAddDamage) + { + Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent())*0.3f, attackObj.AdddamageType, role }, direction); + } Crole.FlashRedEffect();