ssss
This commit is contained in:
parent
1e14910b4d
commit
8873ff3378
@ -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.position = BulletStartPos.position;
|
||||
|
||||
}
|
||||
|
||||
BulletGamobj.transform.position = BulletStartPos.position;
|
||||
// 将子弹加入子弹列表
|
||||
bulltes.Add(BulletGamobj);
|
||||
}
|
||||
|
@ -157,12 +157,12 @@ public class Fun : Base
|
||||
/// <param name="poisonInterval">¼ä¸ô</param>
|
||||
/// <param name="poisonInterval">É˺¦</param>
|
||||
/// <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) =>
|
||||
{
|
||||
Debug.LogError(this.name + "Öж¾buff");
|
||||
targetRole.ApplyPoisonDamage(poisonDuration, poisonInterval,poisonDamage);
|
||||
Debug.Log(this.name + "Öж¾buff");
|
||||
targetRole.ApplyPoisonDamage(poisonDuration, poisonInterval,poisonDamage, AttackRole);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
14
Role/Role.cs
14
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,22 +638,14 @@ public class Role : Fun
|
||||
DOTween.To(() => elapsedTime, x => elapsedTime = x, poisonDuration, poisonDuration)
|
||||
.OnUpdate(() =>
|
||||
{
|
||||
// 每隔 poisonInterval 触发一次伤害
|
||||
if (elapsedTime % poisonInterval < 0.1f) // 用一个小范围检查是否到达了伤害触发时机
|
||||
if (elapsedTime % poisonInterval < 0.1f) // 修改为更精确的触发条件
|
||||
{
|
||||
// 扣除血量
|
||||
if (hp- poisonDamage >= 0)
|
||||
{
|
||||
hp -= poisonDamage;
|
||||
this.bloodLoss(new object[] { this, poisonDamage, DamageType.magicDamage, AttackRange });
|
||||
UnityEngine.Debug.Log($"中毒伤害: {poisonDamage}, 当前血量: {hp}/{maxHp}");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
.OnKill(() =>
|
||||
{
|
||||
// 在 `poisonDuration` 结束后停止伤害
|
||||
UnityEngine.Debug.Log("中毒效果结束");
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user