From 861ba21b13a617c5391bec896a9960a08dffa00a Mon Sep 17 00:00:00 2001 From: GL <2365963573@qq.com> Date: Fri, 3 Jan 2025 20:50:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B0=B4=E9=B2=A8=E9=B1=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Role/Attack.cs | 1 + Role/Bullet.cs | 3 ++- Role/Role.cs | 10 ++++++++-- Role/SmallBullet.cs | 12 +++++++----- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Role/Attack.cs b/Role/Attack.cs index ac669bc..35a656b 100644 --- a/Role/Attack.cs +++ b/Role/Attack.cs @@ -40,6 +40,7 @@ public class Attack : MonoBehaviour [Header("攻击范围显示脚本")] public CharacterClick characterClick; [Header("攻击随机角度范围")] public float Angle=30; [Header("子弹分裂个数")] public int splitNum = 2; + [Header("分裂子弹伤害")] public float SplitAttack = 10; public bool isAttack = true; public bool flag = false; [HideInInspector] public float timer = 0; diff --git a/Role/Bullet.cs b/Role/Bullet.cs index d045d14..3f15cce 100644 --- a/Role/Bullet.cs +++ b/Role/Bullet.cs @@ -304,12 +304,13 @@ public class Bullet : MonoBehaviour for (int i = 0; i < attackObj.splitNum; i++) { // ڵǰƫ - Vector3 randomOffset = new Vector3(Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f)); + Vector3 randomOffset = new Vector3(Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f)); // һСӵ GameObject smallBullet = Instantiate(smallBulletPrefab, transform.position, Quaternion.identity); smallBullet.GetComponent().role = role; smallBullet.GetComponent().attackObj=attackObj; + smallBullet.GetComponent().Target = Target; // ΪСӵ÷з򣨵ǰ + ƫƣ smallBullet.transform.up = currentDirection+randomOffset; diff --git a/Role/Role.cs b/Role/Role.cs index 404b0a1..1b44233 100644 --- a/Role/Role.cs +++ b/Role/Role.cs @@ -115,8 +115,11 @@ public class Role : Fun { go.GetComponent().CreateText(); } + if (temp - hp>0) + { + go.GetComponent().text = (temp - hp).ToString("F0"); // 显示伤害值 + } - go.GetComponent().text = (temp - hp).ToString("F0"); // 显示伤害值 } // 判断角色是否死亡 if (hp <= 0) @@ -306,7 +309,10 @@ public class Role : Fun if (lsanimationHighlight == dieIndex) { SpawnPool.intance.DeadNumber += 1; - Destroy(gameObject); + + Destroy(gameObject); + + } if (lsanimationHighlight == hitIndex) diff --git a/Role/SmallBullet.cs b/Role/SmallBullet.cs index c614ddf..505be78 100644 --- a/Role/SmallBullet.cs +++ b/Role/SmallBullet.cs @@ -24,7 +24,7 @@ public class SmallBullet : Bullet { - this.gameObject.transform.Translate(Vector3.up * Time.deltaTime * bulletData.BulletSpeed); + this.gameObject.transform.Translate(Vector3.up * Time.deltaTime * bulletData.BulletSpeed*8); @@ -45,7 +45,7 @@ public class SmallBullet : Bullet private void OnTriggerEnter2D(Collider2D collision) { Role Crole = collision.gameObject.GetComponent(); - if (Crole) + if (Crole&&Target!= collision.gameObject) { if (Crole.camp != role.camp) { @@ -70,10 +70,12 @@ public class SmallBullet : Bullet { direction = 1; } - Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent()), attackObj.damageTyp, role }, direction); - + Crole.bloodLoss(new object[] { Crole, attackObj.SplitAttack, attackObj.damageTyp, role }, direction); + Crole.FlashRedEffect(); + role.GetComponent().HarmNumber += attackObj.SplitAttack; + Debug.Log("ѹ˺"+ attackObj.SplitAttack); - if (myBulletType != BulletType.Spraying) + if (myBulletType != BulletType.Spraying) {