This commit is contained in:
GL 2025-01-07 17:26:01 +08:00
parent 1e14910b4d
commit 8873ff3378
3 changed files with 27 additions and 26 deletions

View File

@ -435,12 +435,21 @@ public class Attack : MonoBehaviour
// 使用偏移角度调整子弹的发射方向 // 使用偏移角度调整子弹的发射方向
// 只在z轴上进行旋转2D场景 // 只在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; BulletGamobj.transform.position = BulletStartPos.position;
// 将子弹加入子弹列表 // 将子弹加入子弹列表
bulltes.Add(BulletGamobj); bulltes.Add(BulletGamobj);
} }

View File

@ -157,12 +157,12 @@ public class Fun : Base
/// <param name="poisonInterval">¼ä¸ô</param> /// <param name="poisonInterval">¼ä¸ô</param>
/// <param name="poisonInterval">É˺¦</param> /// <param name="poisonInterval">É˺¦</param>
/// <returns></returns> /// <returns></returns>
public Action<Role> CreatePoisonBuff(float poisonDuration, float poisonInterval, float poisonDamage) public Action<Role> CreatePoisonBuff(float poisonDuration, float poisonInterval, float poisonDamage,Role AttackRole)
{ {
return (Role targetRole) => return (Role targetRole) =>
{ {
Debug.LogError(this.name + "Öж¾buff"); Debug.Log(this.name + "Öж¾buff");
targetRole.ApplyPoisonDamage(poisonDuration, poisonInterval,poisonDamage); targetRole.ApplyPoisonDamage(poisonDuration, poisonInterval,poisonDamage, AttackRole);
}; };
} }
} }

View File

@ -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; float elapsedTime = 0f;
@ -638,24 +638,16 @@ public class Role : Fun
DOTween.To(() => elapsedTime, x => elapsedTime = x, poisonDuration, poisonDuration) DOTween.To(() => elapsedTime, x => elapsedTime = x, poisonDuration, poisonDuration)
.OnUpdate(() => .OnUpdate(() =>
{ {
// 每隔 poisonInterval 触发一次伤害 if (elapsedTime % poisonInterval < 0.1f) // 修改为更精确的触发条件
if (elapsedTime % poisonInterval < 0.1f) // 用一个小范围检查是否到达了伤害触发时机 {
{ this.bloodLoss(new object[] { this, poisonDamage, DamageType.magicDamage, AttackRange });
// 扣除血量 UnityEngine.Debug.Log($"中毒伤害: {poisonDamage}, 当前血量: {hp}/{maxHp}");
if (hp- poisonDamage >= 0) }
{ })
hp -= poisonDamage; .OnKill(() =>
UnityEngine.Debug.Log($"中毒伤害: {poisonDamage}, 当前血量: {hp}/{maxHp}"); {
UnityEngine.Debug.Log("中毒效果结束");
});
}
}
})
.OnKill(() =>
{
// 在 `poisonDuration` 结束后停止伤害
UnityEngine.Debug.Log("中毒效果结束");
});
} }
public float WuxingDamage(enemy Target)//五行属性伤害计算 返回倍率减伤或增加伤害 public float WuxingDamage(enemy Target)//五行属性伤害计算 返回倍率减伤或增加伤害