攻击范围修改

This commit is contained in:
GL 2025-01-09 10:35:40 +08:00
parent 078d33a649
commit c8178b2b59
4 changed files with 14 additions and 5 deletions

View File

@ -323,13 +323,13 @@ public class Attack : MonoBehaviour
if (attackCollider&& role.AttackRange !=0)
{
// 设置碰撞体的半径
attackCollider.radius = role.AttackRange-1;
attackCollider.radius = role.AttackRange+2f;
// 计算缩放因子,使得图片的直径与碰撞体的直径匹配
characterClick.OrSizeX = (role.AttackRange-1) * 2f / characterClick.StartSizeX; // * 2f 因为 radius 是半径,图片的尺寸通常是直径
characterClick.OrSizeX = (role.AttackRange+2f) * 2f / characterClick.StartSizeX; // * 2f 因为 radius 是半径,图片的尺寸通常是直径
characterClick.OrSizeY = characterClick.OrSizeX;

View File

@ -86,7 +86,7 @@ public class Bullet : MonoBehaviour
[Header("子弹移动参数")] public bool IsMove = true;
[Header("子弹碰撞体")] public CircleCollider2D Collider2D;
[Header("子弹特效预制体")] public List<GameObject> effectPres = new List<GameObject>();
private float timer = 0;
public float timer = 0;
[Header("子弹攻击数量")] public int NumberOfBulletAttacks = 1;
[Header("攻击目标")] public GameObject Target;
[Header("子弹是否不锁定目标")] public bool noLockEnemy=false;

View File

@ -324,8 +324,11 @@ public class Role : Fun
if (lsanimationHighlight == dieIndex)
{
//SpawnPool.intance.DeadNumber += 1;
SpawnMonster.intance.enemysList.Remove(this.gameObject);
if (SpawnMonster.intance.enemysList.Count<=0)
{
SpawnMonster.intance.Index += 1;

View File

@ -25,10 +25,16 @@ public class SmallBullet : Bullet
this.gameObject.transform.Translate(Vector3.up * Time.deltaTime * bulletData.BulletSpeed*8);
timer += Time.deltaTime;
if (timer > BulletDeadTimer)
{
attackObj.bulltes.Remove(this.gameObject);
Debug.Log("对象已成功移除。当前列表数量:" + attackObj.bulltes.Count);
Destroy(this.gameObject);
}
}
break;