From 8873ff33780bf44fc454aa318094170ac46c3b2f Mon Sep 17 00:00:00 2001 From: GL <2365963573@qq.com> Date: Tue, 7 Jan 2025 17:26:01 +0800 Subject: [PATCH] ssss --- Role/Attack.cs | 17 +++++++++++++---- Role/Fun.cs | 6 +++--- Role/Role.cs | 30 +++++++++++------------------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Role/Attack.cs b/Role/Attack.cs index 59417ab..167d7a2 100644 --- a/Role/Attack.cs +++ b/Role/Attack.cs @@ -435,12 +435,21 @@ public class Attack : MonoBehaviour // 使用偏移角度调整子弹的发射方向 // 只在z轴上进行旋转(2D场景) - Vector3 scatterDirection = Quaternion.Euler(0, 0, currentAngle) * direction; // 只旋转z轴 + + + if (BulletNumber==1) + { + BulletGamobj.transform.up = direction; + } + else + { + Vector3 scatterDirection = Quaternion.Euler(0, 0, currentAngle) * direction; // 只旋转z轴 + // 设置子弹的方向和位置 + BulletGamobj.transform.up = scatterDirection; + + } - // 设置子弹的方向和位置 - BulletGamobj.transform.up = scatterDirection; BulletGamobj.transform.position = BulletStartPos.position; - // 将子弹加入子弹列表 bulltes.Add(BulletGamobj); } diff --git a/Role/Fun.cs b/Role/Fun.cs index 9b7cb57..1b3384d 100644 --- a/Role/Fun.cs +++ b/Role/Fun.cs @@ -157,12 +157,12 @@ public class Fun : Base /// /// ˺ /// - public Action CreatePoisonBuff(float poisonDuration, float poisonInterval, float poisonDamage) + public Action CreatePoisonBuff(float poisonDuration, float poisonInterval, float poisonDamage,Role AttackRole) { return (Role targetRole) => { - Debug.LogError(this.name + "жbuff"); - targetRole.ApplyPoisonDamage(poisonDuration, poisonInterval,poisonDamage); + Debug.Log(this.name + "жbuff"); + targetRole.ApplyPoisonDamage(poisonDuration, poisonInterval,poisonDamage, AttackRole); }; } } diff --git a/Role/Role.cs b/Role/Role.cs index 2f7818f..caa1f75 100644 --- a/Role/Role.cs +++ b/Role/Role.cs @@ -629,7 +629,7 @@ public class Role : Fun - public void ApplyPoisonDamage(float poisonDuration, float poisonInterval, float poisonDamage) + public void ApplyPoisonDamage(float poisonDuration, float poisonInterval, float poisonDamage,Role AttackRole) { // 记录开始时间 float elapsedTime = 0f; @@ -638,24 +638,16 @@ public class Role : Fun DOTween.To(() => elapsedTime, x => elapsedTime = x, poisonDuration, poisonDuration) .OnUpdate(() => { - // 每隔 poisonInterval 触发一次伤害 - if (elapsedTime % poisonInterval < 0.1f) // 用一个小范围检查是否到达了伤害触发时机 - { - // 扣除血量 - if (hp- poisonDamage >= 0) - { - hp -= poisonDamage; - UnityEngine.Debug.Log($"中毒伤害: {poisonDamage}, 当前血量: {hp}/{maxHp}"); - - - } - } - }) - .OnKill(() => - { - // 在 `poisonDuration` 结束后停止伤害 - UnityEngine.Debug.Log("中毒效果结束"); - }); + if (elapsedTime % poisonInterval < 0.1f) // 修改为更精确的触发条件 + { + this.bloodLoss(new object[] { this, poisonDamage, DamageType.magicDamage, AttackRange }); + UnityEngine.Debug.Log($"中毒伤害: {poisonDamage}, 当前血量: {hp}/{maxHp}"); + } + }) + .OnKill(() => + { + UnityEngine.Debug.Log("中毒效果结束"); + }); } public float WuxingDamage(enemy Target)//五行属性伤害计算 返回倍率减伤或增加伤害