修改Bug
This commit is contained in:
parent
27b2f1b025
commit
d198bb4790
@ -316,13 +316,13 @@ public class Attack : MonoBehaviour
|
||||
if (attackCollider)
|
||||
{
|
||||
// 设置碰撞体的半径
|
||||
attackCollider.radius = role.AttackRange;
|
||||
attackCollider.radius = role.AttackRange-1;
|
||||
|
||||
|
||||
|
||||
|
||||
// 计算缩放因子,使得图片的直径与碰撞体的直径匹配
|
||||
characterClick.OrSizeX = role.AttackRange * 2f / characterClick.StartSizeX; // * 2f 因为 radius 是半径,图片的尺寸通常是直径
|
||||
characterClick.OrSizeX = (role.AttackRange-1) * 2f / characterClick.StartSizeX; // * 2f 因为 radius 是半径,图片的尺寸通常是直径
|
||||
characterClick.OrSizeY = characterClick.OrSizeX;
|
||||
|
||||
|
||||
@ -334,7 +334,7 @@ public class Attack : MonoBehaviour
|
||||
|
||||
// 假设攻击范围决定了矩形的长宽比
|
||||
// attackRange * 2 可以增加攻击范围的矩形尺寸,调整比例或常数以适应你的需要
|
||||
boxSize.x = role.AttackRange * 2f + 2; // 设置矩形宽度
|
||||
boxSize.x = role.AttackRange* 2f + 2; // 设置矩形宽度
|
||||
//boxSize.y = role.AttackRange/3; // 设置矩形高度
|
||||
|
||||
// 更新矩形碰撞体的尺寸
|
||||
@ -346,6 +346,7 @@ public class Attack : MonoBehaviour
|
||||
{
|
||||
offSetX += 0.6f;
|
||||
}
|
||||
|
||||
attackRangeSprite.transform.position = new Vector2(attackRangeSprite.transform.position.x - offSetX, attackRangeSprite.transform.position.y);
|
||||
//characterClick.OrSizeY = 1;
|
||||
Debug.Log("修改图片宽度");
|
||||
|
@ -87,10 +87,15 @@ public class Role : Fun
|
||||
if (Hpfiil != null)
|
||||
{
|
||||
Hpfiil.fillAmount = hp / maxHp;
|
||||
|
||||
|
||||
// 使用 DOTween 动画平滑过渡血条填充
|
||||
DOTween.To(() => HpfiilYello.fillAmount, x => HpfiilYello.fillAmount = x, hp / maxHp, 0.8f) // 0.5f 为过渡时间
|
||||
.SetEase(Ease.InOutQuad); // 使用缓动效果,使血条变化更加平滑
|
||||
//if (UIContorl.instance.NowShowInfo!=null&&UIContorl.instance.NowShowInfo.Id == 1)
|
||||
//{
|
||||
// UIContorl.instance.NowShowInfo.UpDateShow("1", "Enemy_001", "0", "3", "1", "测试文档一", hp, maxHp);
|
||||
//}
|
||||
}
|
||||
|
||||
// 更新血量文本效果
|
||||
|
Loading…
Reference in New Issue
Block a user